求大佬帮忙看看哪里出了问题
#include <stdio.h>#define MAXN 20
typedef struct student{
int sID;
char name[20];
int score;
char grade;
}STUDENT;
int setGrade( STUDENT stu[], int n );
void inputData( STUDENT stu[], int n );
void printData( STUDENT stu[], int n );
int main()
{
STUDENT stu[MAXN];
int n, i, count;
scanf("%d", &n); /* n为人数 */
inputData(stu, n); /* 输入n位同学的信息 */
count = setGrade(stu, n); /* 根据成绩划分等级,并统计不及格人数 */
printf("The count for failed (<60): %d\n", count); /* 输出不及格人数 */
printData(stu, n); /* 输出n位同学的信息 */
return 0;
}
void inputData( STUDENT stu[], int n)
{
int i;
for(i = 0; i < n; i++){
scanf("%d%s%d", &stu[i].sID, stu[i].name, &stu[i].score);
}
}
int setGrade( STUDENT stu[], int n )
{
int i,count=0;
for(i=0;i<n;i++){
if(stu[i].score<60)
count++;}
return count;
}
void printData( STUDENT stu[], int n )
{
int i,grade,A,B,C,D;
for(i=0;i<n;i++)
{
if(stu[i].score<59)
grade=D;
else if(stu[i].score>60&&stu[i].score<69)
grade=C;
else if(stu[i].score>70&&stu[i].score<84)
grade=B;
else
grade=A;
}
for(i = 0; i < n; i++){
printf("%d%s%d", &stu[i].sID, stu[i].name, &stu[i].grade);
}
}