个人成绩管理系统

 #include< stdio.h>
 #include< string.h>
 #include< stdlib.h>
void sum(double x1,double x2,double x3,double x4,double x5);
void aver(double x1,double x2,double x3,double x4,double x5);
void maxmin(double x1,double x2,double x3,double x4,double x5);
void restudy(double x1,double x2,double x3,double x4,double x5);
void e(double x1,double x2,double x3,double x4,double x5);
void f(double x1,double x2,double x3,double x4,double x5);
void z();
int main()
{
    char a[30],b[30];
    int i = 0;
    printf("欢迎来到个人成绩管理系统!\n");
    printf("请输入用户名:\n");
    while(1)
    {
        gets(a);
        printf("请输入密码:\n");
        gets(b);
        if((strcmp(a,"燕雨")!=0)||(strcmp(b,"19990522")!=0))
        {
            i++;
            if(i==3)
            {
                printf("password error! you can not use software:\n");
                exit(0);
            }
            printf("密码错误,你还有%d次机会。\n",3-i);
            printf("请输入用户名:\n");
        }
        else
            break;
    }
    z();
}

void z()
{
    int x;
    double A,B,C,D,E;
    printf("登录成功!\n");
    printf("请按照系统提示输入各科分数。\n");
    printf("高数:");
    scanf("%lf",&A);
    printf("英语:");
    scanf("%lf",&B);
    printf("C语言:");
    scanf("%lf",&C);
    printf("java程序设计:");
    scanf("%lf",&D);
    printf("体育:");
    scanf("%lf",&E);
 oo:printf("成绩录入已完成。");
 qq:printf("亲,请选择选项!(输入1~7)\n");
    printf("1.查看各科总分\n");
    printf("2.查看各科平均分\n");
    printf("3.查看各科最高分、最低分\n");
    printf("4.查看所挂科需要重修的科目\n");
    printf("5.查看下学期需要努力的方向\n");
    printf("6.查看自己的优势学科\n");
    printf("7.退出\n");
    scanf("%d",&x);
    if(x==1)
        sum(A,B,C,D,E);
    else if(x==2)
        aver(A,B,C,D,E);
    else if(x==3)
        maxmin(A,B,C,D,E);
    else if(x==4)
        d(A,B,C,D,E);
    else if(x==5)
        e(A,B,C,D,E);
    else if(x==6)
        f(A,B,C,D,E);
    else if(x==7)
        exit(0);
    else
    {
        printf("兄dei没有此选项哦!\n");
        goto qq;
    }

}

void sum(double x1,double x2,double x3,double x4,double x5)
{

    double sum;
    char y[3];
    sum=x1+x2+x3+x4+x5;
    printf("你的总成绩为: %.2lf",sum);
    printf("是否需要返回到主页面?(YES  or  NO)\n");
    getchar();
    gets(y);
    /*if(strcmp(y,"YES")==0)
        goto qq;
    else
        return 0;*/
}

void aver(double x1,double x2,double x3,double x4,double x5)
{
    double average;
    char y[3];
    average=(x1+x2+x3+x4+x5)/5;
    printf("你的平均分为:%.2lf",average);
    printf("是否需要返回到主页面?(YES  or  NO)\n");
    getchar();
    gets(y);
   /* if(strcmp(y,"YES")==0)
        goto oo;
    else
        return 0;*/
}
void maxmin(double x1,double x2,double x3,double x4,double x5)
{
    /*struct persion
    {
        char name[10];
        double a[5];
    }score[5]={"高数",0,"英语",0,"C语言",0,"java程序设计",0,"体育",0};
    char score_name[10];
    int i;
    double max=0;
    struct score beyond[5]={{x1,"高数"}{x2,"英语"}{x3,"C语言"}{x4,"java程序设计"}{x5,"体育"}}
    for(i=0;i<4;i++)
    {
        if(a[i]>max
            max=a[i];
    }*/
    double max=0,min=1000,a[5];
    int i,y,p;
    a[0]=x1;
    a[1]=x2;
    a[2]=x3;
    a[3]=x4;
    a[4]=x5;
    for(i=0; i<5; i++)
    {
        if(a[i]<min)
        {
            min=a[i];
            p=i;
        }
    }
    for(i=0; i<5; i++)
    {
        if(a[i]>max)
        {
            max=a[i];
            y=i;
        }
    }
    printf("各科最高分为:%.2lf\n",max);
    if(y==0)
        printf("对应学科为:高数\n");
    else if(y==1)
        printf("对应学科为:英语\n");
    else if(y==2)
        printf("对应学科为:C语言\n");
    else if(y==3)
        printf("对应学科为:java程序设计\n");
    else if(y==4)
        printf("对应学科为:体育\n");


    printf("各科最低分为:%.2lf\n",min);
    if(p==0)
        printf("对应学科为:高数\n");
    else if(p==1)
        printf("对应学科为:英语\n");
    else if(p==2)
        printf("对应学科为:C语言\n");
    else if(p==3)
        printf("对应学科为:java程序设计\n");
    else if(p==4)
        printf("对应学科为:体育\n");
}

void d(double x1,double x2,double x3,double x4,double x5)
{
    double a[5];
    int i,y;
    a[0]=x1;
    a[1]=x2;
    a[2]=x3;
    a[3]=x4;
    a[4]=x5;
    for(i=0; i<5; i++)
    {
        if(a[i]<60)
        {
            if(i==0)
                printf("高数需要重修");
            if(i==1)
                printf("英语需要重修");
            if(i==2)
                printf("C语言需要重修");
            if(i==3)
                printf("java程序设计需要重修");
            if(i==4)
                printf("体育需要重修");
        }
    }

}
void e(double x1,double x2,double x3,double x4,double x5)
{
    double min=10000,a[5];
    int i,y;
    a[0]=x1;
    a[1]=x2;
    a[2]=x3;
    a[3]=x4;
    a[4]=x5;
    for(i=0; i<5; i++)
    {
        if ( a[i] < min)
        {
            min=a[i];
            y=i;
        }
    }
    if(y==0)
        printf("下学期需要努力的学科为:高数\n");
    else if(y==1)
        printf("下学期需要努力的学科为:英语\n");
    else if(y==2)
        printf("下学期需要努力的学科为:C语言\n");
    else if(y==3)
        printf("下学期需要努力的学科为:java程序设计\n");
    else if(y==4)
        printf("下学期需要努力的学科为:体育\n");
}
void f(double x1,double x2,double x3,double x4,double x5)
{
    double max=0,a[5];
    int i,y;
    a[0]=x1;
    a[1]=x2;
    a[2]=x3;
    a[3]=x4;
    a[4]=x5;
    for(i=0; i<5; i++)
    {
        if(a[i]>max)
        {
            max=a[i];
            y=i;
        }
    }
    if(y==0)
        printf("优势学科为:高数\n");
    else if(y==1)
        printf("优势学科为:英语\n");
    else if(y==2)
        printf("优势学科为:C语言\n");
    else if(y==3)
        printf("优势学科为:java程序设计\n");
    else if(y==4)
        printf("优势学科为:体育\n");
}



#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <time.h>
#include<conio.h>
int caizigame();
int sizeyunsuan();
void z();
int main()
{
    char a[30],b[30];
    int i = 0;
    printf("欢迎来到个人成绩管理系统!\n");
    printf("请输入用户名:\n");
    while(1)
    {
        gets(a);
        printf("请输入密码:\n");
        gets(b);
        if((strcmp(a,"燕雨")!=0)||(strcmp(b,"19990522")!=0))
        {
            i++;
            if(i==3)
            {
                printf("password error! you can not use software:\n");
                exit(0);
            }
            printf("密码错误,你还有%d次机会。\n",3-i);
            printf("请输入用户名:\n");
        }
        else
            break;
    }
    z();
}
void z()
{
    int x,y,z,w;
    printf("登录成功,欢迎回来!\n");
    while(1)
    {
        printf("请选择游戏:\n");
        printf("1.猜数字小游戏:\n");
        printf("2.四则运算小游戏:\n");
        scanf("%d",&x);
        if(x==1)
        {
            srand((unsigned int)time(NULL));
            y = (rand()%100)+1;
            caizigame(y);
        }
        if(x==2)
        {

            sizeyunsuan();
        }

        /* ;
         else
         {
             printf("兄dei没有此选项哦!\n");
             goto qq;
         }*/

    }
}
int caizigame(int y)
{
    int x,i,count=0;
    char a[3];
    printf("请输入一个整数(1~100):");
    while(1)
    {
        scanf("%d",&x);
        if(y<x)
        {
            printf("不对,猜大啦,请继续\n");
            count++;
        }
        else if(y>x)
        {
            printf("不对,猜小啦,请继续\n");
            count++;
        }
        else
        {
            printf("恭喜你猜对啦!!\n");
            printf("所猜次数为:%d次!\n",count);
            break;
        }
    }
    printf("\n按任意键返回主菜单!!\n");
    getch();
}
int   sizeyunsuan()
{

    int w,z,q,o,a,b,c,d,l;
    int count=0,m;
    printf("请输入你想做的题目数:");
    scanf("%d",&o);
    printf("请选择模式:\n");
    printf("1,加法  2,减法  3,乘法  4,除法\n");
    scanf("%d",&q);
    l=o;
    while(o--)
    {

        srand((unsigned int)time(NULL));
        w = (rand()%100)+1;
        z = (rand()%100)+1;
        if(q==1)
        {
            printf("%d + %d = ?\n",w,z);
            scanf("%d",&a);
            if(w+z==a)
            {
                printf("答案正确!\n");
                count++;
            }
            else printf("答案错误!\n");
        }
        else if(q==2)
        {
            printf("%d - %d = ?\n",w,z);
            scanf("%d",&b);
            if(w-z==b)
            {
                printf("答案正确!\n");
                count++;
            }
            else printf("答案错误!\n");
        }
        else if(q==3)
        {
            printf("%d * %d = ?\n",w,z);
            scanf("%d",&c);
            if(w*z==c)
            {
                printf("答案正确!\n");
                count++;
            }
            else printf("答案错误!\n");
        }
        else
        {
            printf("%d / %d = ?\n",w,z);
            scanf("%d",&d);
            if(w/z==d)
            {
                printf("答案正确!\n");
                count++;
            }
            else printf("答案错误!\n");
        }
        printf("%d\n",&count);
    }
    printf("本次游戏,你的正确率为:%d",&count);
    printf("\n按任意键返回主菜单!!\n");
    getch();
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

beyond谚语

你的鼓励将是我创作的最大动力

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

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

打赏作者

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

抵扣说明:

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

余额充值