题目描述
现有有N个学生的数据记录,每个记录包括学号、姓名、三科成绩。 编写一个函数input,用来输入一个学生的数据记录。 编写一个函数print,打印一个学生的数据记录。 在主函数调用这两个函数,读取N条记录输入,再按要求输出。 N<100
输入
学生数量N占一行 每个学生的学号、姓名、三科成绩占一行,空格分开。
输出
每个学生的学号、姓名、三科成绩占一行,逗号分开。
样例输入
2
a100 zhblue 70 80 90
b200 newsclan 90 85 75
样例输出
a100,zhblue,70,80,90
b200,newsclan,90,85,75
#include<stdio.h>
#include<math.h>
struct score
{
char id[30];
char name[30];
int a,b,c;
};
int main()
{
struct score t;
int n;
scanf("%d",&n);
while(n--)
{
scanf("%s",t.id);
scanf("%s",t.name);
scanf("%d%d%d",&t.a,&t.b,&t.c);
printf("%s,%s,%d,%d,%d\n",t.id,t.name,t.a,t.b,t.c);
}
return 0;
}