编写一个函数print(),打印学生的成绩数组,该数组记录每个学生的数据
编写一个函数print(),打印学生的成绩数组,该数组记录每个学生的数据,每个记录包括num,name和score[3...
编写一个函数print(),打印学生的成绩数组,该数组记录每个学生的数据,每个记录包括
num,name和score[3 展开
num,name和score[3 展开
展开全部
#include "stdio.h"
#include <stdlib.h>
#define SIZE 50
struct student{
char num[20];
char name[20];
int score[3];
} stud[SIZE];
void print() /* 输出学生的信息 */
{
int i;
printf("\n");
for(i=0;i<SIZE;i++)
printf("%s %s %d %d %d\n",stud[i].num,stud[i].name,stud[i].score[0],stud[i].score[1],stud[i].score[2]);
}
void main()
{
int i;
for(i=0;i<SIZE;i++)
{
printf("第%d个学生的信息:\n",i+1);
scanf("%s%s%d%d%d",stud[i].num,stud[i].name,&stud[i].score[0],&stud[i].score[1],&stud[i].score[2]);
}
print();
}
#include <stdlib.h>
#define SIZE 50
struct student{
char num[20];
char name[20];
int score[3];
} stud[SIZE];
void print() /* 输出学生的信息 */
{
int i;
printf("\n");
for(i=0;i<SIZE;i++)
printf("%s %s %d %d %d\n",stud[i].num,stud[i].name,stud[i].score[0],stud[i].score[1],stud[i].score[2]);
}
void main()
{
int i;
for(i=0;i<SIZE;i++)
{
printf("第%d个学生的信息:\n",i+1);
scanf("%s%s%d%d%d",stud[i].num,stud[i].name,&stud[i].score[0],&stud[i].score[1],&stud[i].score[2]);
}
print();
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询