编写一个函数print(),打印学生的成绩数组,该数组记录每个学生的数据,每个记录包括

num,name和score[3]。在主函数输入这些记录,用print()函数输出这些学生记录。(运用结构体知识,C++/C均可) 请帮忙看一下怎么写,谢谢!(急)

#include "stdio.h"
#include <stdlib.h>
#define SIZE 50

struct student{
char num[20];
char name[20];
int score[3];
} stud[SIZE];

void print() /* 输出学生的信息 */
{
int i;
printf("\n");
for(i=0;i<SIZE;i++)
printf("%s %s %d %d %d\n",stud[i].num,stud[i].name,stud[i].score[0],stud[i].score[1],stud[i].score[2]);
}

void main()
{
int i;
for(i=0;i<SIZE;i++)
{
printf("第%d个学生的信息:\n",i+1);
scanf("%s%s%d%d%d",stud[i].num,stud[i].name,&stud[i].score[0],&stud[i].score[1],&stud[i].score[2]);
}
print();
}
温馨提示:答案为网友推荐,仅供参考