有高手在吗

来源:百度知道 编辑:UC知道 时间:2024/06/29 00:11:39
编写一个函数printf,打印学生的成绩数组,该数组中有5个学生的数据记录,有个记录包nvm,name,score[3],用主函数输入这空记录,(用printf函数输出)
(麻烦帮下拉,用指针)

没有用指针,不明白你的意思,用了数组.

#include <stdio.h>

main(){
int i,j;
struct student{
char name[20];
int score[3];
}stu[5];

for(i=0;i<5;i++){
gets(stu[i].name);

for(j=0;j<3;j++){
printf("\nEnter student %d score %d:",i+1,j+1);
scanf("%d",&stu[i].score[j]);
}
}

for(i=0;i<5;i++){
printf("\n%s",stu[i].name);
for(j=0;j<3;j++)
printf("\nEnter student %d score %d:",j+1,stu[i].score[j]);

}

getch();
}

给点分数好不好