解题思路:结构体
注意事项:
参考代码:
#include<stdio.h>
struct student
{
char id[20];
char name[20];
int score1;
int score2;
int score3;
};
int main()
{
struct student stu[1003];
int n;
int i;
scanf("%d",&n);
getchar();
for(i = 0;i<n;i++)
{
scanf("%s",stu[i].id);
getchar();
scanf("%s",stu[i].name);
scanf("%d %d %d",&stu[i].score1,&stu[i].score2,&stu[i].score3);
getchar();
}
for(i = 0;i<n;i++)
{
printf("%s,",stu[i].id);
printf("%s,",stu[i].name);
printf("%d,%d,%d\n",stu[i].score1,stu[i].score2,stu[i].score3);
}
return 0;
}
0.0分
0 人评分
C语言训练-素数问题 (C语言代码)浏览:1685 |
人见人爱A+B (C语言代码)浏览:658 |
C语言程序设计教程(第三版)课后习题7.4 (C语言代码)浏览:1297 |
WU-判定字符位置 (C++代码)浏览:1467 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:627 |
【矩阵】 (C++代码)浏览:982 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:385 |
Tom数 (C语言代码)浏览:576 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:525 |
母牛的故事 (C语言代码)浏览:515 |