学生成绩系统C语言指针法实现(包含:统计学生总分、平均分、不及格人数)

#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");
}
  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Qian_Qian_IT

感谢您的赏识,我将持续创作~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值