输入
学生数量N占一行 每个学生的学号、姓名、三科成绩占一行,空格分开。
输出
每个学生的学号、姓名、三科成绩占一行,逗号分开。
样例输入复制
2 a100 clang 70 80 90 b200 dotcpp 90 85 75
样例输出复制
a100,clang,70,80,90 b200,dotcpp,90,85,75
#include <stdio.h>
struct STUDENT
{
char num[10];
char name[10];
int score1;
int score2;
int score3;
};
void input(struct STUDENT *stu,int n)
{
int i;
for(i=0;i<n;i++)
{
scanf("%s%s%d%d%d",&stu[i].num,&stu[i].name,&stu[i].score1,&stu[i].score2,&stu[i].score3);
}
}
void output(struct STUDENT *stu,int n)
{
int i;
for(i=0;i<n;i++)
{
printf("%s,%s,%d,%d,%d\n",stu[i].num,stu[i].name,stu[i].score1,stu[i].score2,stu[i].score3);
}
}
int main()
{
int N;
struct STUDENT students[100];
scanf("%d",&N);
input(students,N);
output(students,N);
return 0;
}