想知道为什么输入数据之后没有显示输出结果?是输入的格式不对吗?还是调用不对呢??
题目,输出结果和代码都在下面
#include<stdio.h>
struct grade
{
int num;
char name;
int score[3];
};
struct grade student[5];
char print(struct grade student[],int a)
{
printf("输出结果为:\n");
for(int i=0;i<a;i++)
{
printf("%d ",student[i].num);
printf("%s",student[i].name);
printf("%d %d %d",student[i].score[0],student[i].score[1],student[i].score[2]);
printf("\n");
}
}
int main()
{
printf("请输入记录:");
for(int i=0;i<5;i++)
{
scanf("%d",&student[i].num);
scanf("%s",student[i].name);
scanf("%d",&student[i].score[0]);
scanf("%d",&student[i].score[1]);
scanf("%d",&student[i].score[2]);
}
print(student,5); //调用函数
return 0;
}
//输入1 grh 89 56 23 2 lop 78 45 12 3 asc 79 46 13 4 rfdg 84 51 20 5 fdr 95 62 30