#include <stdio.h>
#include <string.h>
typedef struct{
    char xuehao[1000];
    char name[200];
    char gene[40];
    int age;
}student;
typedef struct{char P[100];}stu;

int main() {
    int M,N;
   
    while (scanf("%d", &N) != EOF) { // 注意 while 处理多个 case
        // 64 位输出请用 printf("%lld") to 
student s[N];

for(int i=0;i<N;i++){
scanf("%s %s %s %d",&s[i].xuehao,&s[i].name,&s[i].gene,&s[i].age);}
scanf("%d",&M);
stu  a[M];
for(int j=0;j<M;j++){
    scanf("%s",&a[j].P);

}
for(int j=0;j<M;j++){ int biao=-1;
for(int i=0;i<N;i++){
  
     if(strcmp(s[i].xuehao , a[j].P)==0){biao=i;printf("%s %s %s %d\n", s[i].xuehao, s[i].name, s[i].gene, s[i].age);break;}
     }
     if(biao==-1) printf("No Answer!\n");
     }
    return 0;
    }}

调试了老半天 首先是查找还是没查找到都要换行

还有 学号都要用char,比较用strcmp

其次 不能把要查找的学号放在student里,要新建