c语言案例 学生试卷分数统计(C language case, student test paper, score statistics)
c语言案例 学生试卷分数统计(C language case, student test paper, score statistics)
#包括< stdio. h >
#包括<
#定义尺寸300
typedef struct
{
int num;
int分数[ 3 ];
}学生;
枚举类型的声明/ /
{
虚假的,真实的
}旗;
国际accept_data(学生研究[ ],[ ]国际级);
无效show_data(学生研究[ ],int和int级[ ]);
空绘制(int级[ [] ]);
空值(int *最大,int *,双*,双[…],双F [] ],学生,];
无效show_data2(int max,int min、双通、双大道[ ],[ ]双F);
国际main()
{
整数,最大,最小;
双程= 0;;
int等级[ 11 ] = 0 };/ /
学生研究[规模];
双通道[尺寸],F(尺寸);
总和= accept_data(Stu,级);
show_data(斯图,和,级);
绘图(等级);
计数(和最大,最小和,通过,大道,F,斯图,总和);/ /
show_data2(max,min,通大道,F);
返回0;
}
accept_data(学生研究[ ],[ ]国际级)
{
int,i = 0,温度,A1,A2;
国旗;
printf(“请输入计算总评成绩时平时成绩与期末成绩所占的比例,用整数表示:”);
scanf(“%d %d”,与A1和A2);
对于(i = 0;i
{
printf(“\n请输入学号:”);
scanf(“%d”,与斯图[我]。Num);
如果(学生编号= = 1)/“=”不是“=”
{
总和= i;
中断;
}
printf(“\n请输入学生的平时成绩与期末成绩:”);
标志=真/;
当(标志= TRUE)
{
scanf(“%d %d”,与斯图[我]。得分[ 0 ],[我]和斯图。得分[ 1 ]);
如果(0)< 0=100,我将分数为0。
斯图[我]。得分[ 1 ] = 100和[我]。得分[ 1 ] = 0)
标志=假;
其他的
printf(“\n 007错误数据!请再次输入学生的平时成绩与期末成绩:\n”);
}
温度=(int)(1×100×1)。分数0。+ 1×100。
斯图[我]。得分[ 2 ] =温度/分数[ 2 ]没有得分[ 3 ]。
临时(= 1)10;
如果(= = 10)
年级[ 10 ] +;
其他的
品位[温度+ 1 ];
}
收起回复;
}
无效show_data(学生研究[ ],int和int级[ ])
{
int,j;
为(i = 0;i
{
printf(“4D”,斯图[我]。Num);/ /
对于(j = 0;j<3;j + +)/ /
printf(“4D”,斯图[我]。评分[ J ]);
printf(“\n”);
}
为(i = 1;i < = 10;i++)/ /我的范围要弄清楚
printf(“4D”,等级[我]);
printf(“\n”);
}
空值(int *最大,int *,双*,双[…],双F [] ],学生,]
{
int i,j,p_sum = 0;// p_sum为期末成绩及格的总人数
int总[ 3 ] = { 0 };//平时成绩,期末,总评成绩的初始值设为0
双温;/ /存储平时成绩与平均平时成绩的差,期末成绩与期末平均成绩的差,总评成绩与总评平均的差
*最大= =学生[ 0 ]。得分[ 1 ];/ /
如果(Stu [ 0 ]。得分[ 1 ] > = 60)p_sum + +;
对于(i=1;i
{
如果(学生[我]得分[ 1 ] *最大)* max =学生[我]得分[ 1 ];
如果(学生[分数1)
如果(Stu [我]。得分[ 1 ] > = 60)p_sum ++;// p_sum为期末成绩及格的总人数
}
*通行证=(1。
0*p_sum/sum *100); / / the pass rate of *100, the output of a printf output% pass rate of *pass%
For (i=0; i<3; i++)
For (j=0; j
Total[i]=total[i]+stu[j].score[i]; / / calculate grades and final grades, and, and
For (i=0; i<3; i++)
Ave[i]=total[i]/sum; / / average calculation, the fin