#include<stdio.h>
#define MAX_LEN 100
int main()
{
int i,step,Stu_Sum=0,Fail_Chinese_sum=0,Fail_Math_sum=0,Fail_English_sum=0;
float Score_Chinese[MAX_LEN],Score_Math[MAX_LEN],Score_English[MAX_LEN];
float *Pointer_Chinese,*Pointer_Math,*Pointer_English,Score_Chinese_Sum=0,Score_Math_Sum=0,Score_English_Sum=0;
Pointer_Chinese=Score_Chinese;
Pointer_Math=Score_Math;
Pointer_English=Score_English;
printf(" * * * * * * Student Score System * * * * * * \n\n");
printf(" * * * * * * Now Please Follow Tip Input * * * * * * \n\n");
printf("1.Input 1 Logging Student Score .\n\n");
printf("2.Input 2 Statistics Student Sum Score And Average Score .\n\n");
printf("3.Input 3 Statistics Fail Student .\n\n");
printf("4.Input 4 Log Out System .\n\n");
while(1)
{
printf("Input : ");
scanf("%d",&step);
printf("\n");
while(step<1||step>4)
{
printf("Input Error £¬Please Input Again .\n\n");
scanf("%d",&step);
}
if(step==4) break;
switch(step)
{
case 1:
{
printf("Student Sum £º");
scanf("%d",&Stu_Sum);
printf("\n * * * * * * Chinese Score * * * * * * \n\n");
for(i=0;i<Stu_Sum;i++)
{
scanf("%f",&Score_Chinese[i]);
Score_Chinese_Sum+=*Pointer_Chinese++;
}
printf("\n * * * * * * Math Score * * * * * * \n\n");
for(i=0;i<Stu_Sum;i++)
{
scanf("%f",&Score_Math[i]);
Score_Math_Sum+=*Pointer_Math++;
}
printf("\n * * * * * * English Score * * * * * * \n\n");
for(i=0;i<Stu_Sum;i++)
{
scanf("%f",&Score_English[i]);
Score_English_Sum+=*Pointer_English++;
}
Pointer_Chinese=Score_Chinese;
Pointer_Math=Score_Math;
Pointer_English=Score_English;
}break;
case 2:
{
for(i=0;i<Stu_Sum;i++)
{
printf("Z 0 9 4 1 8 1 0 %d :Sum Score £º%.1f Average Score : %.2f\n\n",i+1,Pointer_Chinese[i]+Pointer_Math[i]+Pointer_English[i],(Pointer_Chinese[i]+Pointer_Math[i]+Pointer_English[i])/3);
}
}break;
case 3:
{
for(i=0;i<Stu_Sum;i++)
{
if(Score_Chinese[i]<60) Fail_Chinese_sum++;
if(Score_Math[i]<60) Fail_Math_sum++;
if(Score_English[i]<60) Fail_English_sum++;
}
printf("Chinese Fail : %d People !\n\n",Fail_Chinese_sum);
printf("Math Fail : %d People !\n\n",Fail_Math_sum);
printf("English Fail : %d People !\n\n",Fail_English_sum);
}break;
}
printf("\n1.Input 1 Logging Student Score .\n\n");
printf("2.Input 2 Statistics Student Sum Score And Average Score .\n\n");
printf("3.Input 3 Statistics Fail Student .\n\n");
printf("4.Input 4 Log Out System .\n\n");
}
printf(" * * * * * * Well Come You Back Again * * * * * * \n\n");
}
学生成绩系统C语言指针法实现(包含:统计学生总分、平均分、不及格人数)
最新推荐文章于 2022-12-19 23:17:34 发布