

/*
1.编写一个函数print,打印一个学生的成绩数,该数组中有5个学生的数据记录
,每个记录包括num、name、sore[3],
用主函数输入这些记录,用print函数输出这些记录。
*/
#include<stdio.h>
#include<string.h>
#define N 5
struct student
{char num[6];
char name[8];
int score[3];
}stu[N];
void print(struct student stu[N])
{ int i,j;
for(i=0;i<N;i++)
{
printf("%5s%10s",stu[i].num,stu[i].name);
for(j=0;j<3;j++)
printf("%9d",stu[i].score[j]);
printf("\n");
}
}
void main()
{int i,j ;
for(i=0;i<N;i++)
{printf("Input date of student:\n");
printf("no.:");
scanf("%s",&stu[i].num);
printf("name:");
scanf("%s",&stu[i].name);
for(j=0;j<3;j++)
{
printf("score %d:",j+1);
scanf("%d",&stu[i].score[j]);
}
printf("\n");
}
print(stu);
}