解题思路:
注意事项:
参考代码:
#include<stdio.h>
#define N 100
struct student
{
char num[10];
char name[10];
int score[3];
};
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].score,stu[i].score+1,stu[i].score+2);
//stu[i].score是score数组的首地址
}
void print(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].score[0],stu[i].score[1],stu[i].score[2]);
}
int main()
{
struct student stu[N];
int n;
scanf("%d",&n);
input(stu,n);
print(stu,n);
return 0;
}
0.0分
0 人评分
C语言训练-求函数值 (C语言代码)浏览:937 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:751 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:583 |
核桃的数量 (C语言代码)浏览:671 |
1071题解浏览:493 |
1035 题解浏览:785 |
Hello, world! (C语言代码)浏览:824 |
1231题解(注意理解“输入多个测试实例”)浏览:788 |
C二级辅导-公约公倍 (C语言代码)浏览:1311 |
C语言程序设计教程(第三版)课后习题9.4 (C语言代码)浏览:484 |