关于十个学生学号班级年龄,三科成绩(高数,计算机,C语言)以及每个学生平均分和总成绩的C语言编程程序
来源:百度知道 编辑:UC知道 时间:2024/06/03 17:49:51
#include"stdio.h"
#define MAX_SIZE 1000
typedef struct
{
int mun[MAX_SIZE]; //学号
int age[MAX_SIZE]; //年龄
char class_name[MAX_SIZE]; //班级
int math_score[MAX_SIZE]; //高数
int comp_score[MAX_SIZE]; //计算机
int c_score[MAX_SIZE]; //C语言
int sum_score[MAX_SIZE]; //总分
int aver_score[MAX_SIZE]; //平均分
}score;
void main()
{ score L;
int i;
printf("请按顺序输入第1~10个学生的:\n学号,班级,年龄,高数,计算机,C语言三科成绩\n");
for(i=0;i<10;i++)
{
scanf("%d%s%d%d%d%d",&L.mun[i],&L.class_name[i],&L.age[i],&L.math_score[i],&L.comp_score[i],&L.c_score[i]);
//输入各学生学号,班级,年龄,高数,计算机,C语言三科成绩
L.sum_score[i]=L.math_score[i]+L.comp_score[i]+L.c_score[i]; //计算总分
L.aver_score[i]=(L.math_score[i]+L.comp_