参考代码:
#include <stdio.h> struct Student { char ID[20]; char Name[20]; int Score[3]; }; int input(int n,struct Student stu[]); int print(int n,struct Student stu[]); int main() { struct Student stu[100]; int n = 0; scanf("%d",&n); input(n,stu); print(n,stu); return 0; } int input(int n,struct Student stu[]) { int i = 0; for(i=0;i<n;i++) { scanf("%s",stu[i].ID); scanf("%s",stu[i].Name); scanf("%d%d%d",&stu[i].Score[0],&stu[i].Score[1],&stu[i].Score[2]); } return 0; } int print(int n,struct Student stu[]) { int i = 0; for(i=0; i<n; i++) { printf("%s,",stu[i].ID); printf("%s,",stu[i].Name); printf("%d,%d,%d",stu[i].Score[0],stu[i].Score[1],stu[i].Score[2]); printf("\n"); } return 0; }
欢迎点评!!!
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:939 |
小明A+B (C语言代码)浏览:1256 |
剪刀石头布 (C语言代码)不知道怎么直接在scanf中用枚举变量浏览:1315 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:596 |
简单的a+b (C语言代码)浏览:340 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:1162 |
WU-拆分位数 (C++代码)浏览:781 |
C语言程序设计教程(第三版)课后习题6.8 (C++代码)浏览:587 |
C语言程序设计教程(第三版)课后习题8.7 (C语言代码)浏览:596 |
C语言程序设计教程(第三版)课后习题10.2 (C语言代码)浏览:687 |