用结构体解决问题,帮我看看哪儿错了,问题和我的代码在图片,利用结构体输出学生信息
把两门成绩定义为int型,然后加一个for循环遍历判断两门成绩大于90分的学生就可以了。
#include <stdio.h>
typedef struct Student{
char stu_num[13];
char stu_name[21];
int stu_program_score;
int stu_math_score;
};
int main(void){
Student S[107];
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",&S[i].stu_num);
scanf("%s",&S[i].stu_name);
scanf("%d",&S[i].stu_program_score);
scanf("%d",&S[i].stu_math_score);
}
for(i=0;i<n;i++){
if(S[i].stu_program_score>90&&S[i].stu_math_score>90){
printf("%s\n",S[i].stu_num);
}
}
return 0;
}