#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();
}
个人成绩管理系统
最新推荐文章于 2021-12-23 17:39:37 发布