You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

251 lines
3.2 KiB

6 years ago
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
//<2F><><EFBFBD><EFBFBD>ϰ<EFBFBD><CFB0><EFBFBD>
struct test{
char fuhao;
int a; //<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߼<EFBFBD><DFBC><EFBFBD>
int b; //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߼<EFBFBD><DFBC><EFBFBD>
int rezult; //<2F><><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE>
}qst[10]; //10<31><30><EFBFBD><EFBFBD>Ŀquestion
void jiemian(); //<2F><><EFBFBD><EFBFBD>
void xitong(); //ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
int dati(); //ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
void pingjia(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int main()
{
jiemian();
xitong();
pingjia();
return 0;
}
//<2F><><EFBFBD><EFBFBD>
void jiemian()
{
int kind; //<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
printf("<EFBFBD>˲<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Сѧ1<EFBFBD><EFBFBD>2<EFBFBD>\n");
printf("-----------------------------\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>밴 1 <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>\n");
printf("-----------------------------\n");
scanf("%d",&kind);
while(kind!=1)
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1\n");
scanf("%d",&kind);
}
printf("ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ\n");
printf("-----------------------------\n");
printf("ף<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
printf("-----------------------------\n");
printf("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
printf("---------------------\n");
}
//ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
void xitong()
{
int a; //aΪ<61><CEAA><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD>Ǽ<EFBFBD><C7BC><EFBFBD>
int b,c; //b,cΪ<63><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int i; //<2F><><EFBFBD><EFBFBD>
srand(time(NULL));
for(i=0;i<10;i++){
a=rand();
b=rand()%51;
c=rand()%51;
if(a%2==0)
{
qst[i].fuhao='+';
while(b+c>50)
{
b=rand()%51; //<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD>Ƿ񳬸<C7B7>
c=rand()%51;
}
}
else
{
qst[i].fuhao='-';
if(b<c)
{
int t;
t=b;
b=c;
c=t; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
}
}
qst[i].a=b;
qst[i].b=c;
if(a%2==0) qst[i].rezult=b+c;
else qst[i].rezult=b-c;
}
/* for(i=0;i<10;i++)
printf("<EFBFBD><EFBFBD>%d<><64>Ϊ<EFBFBD><CEAA>%d%c%d=\n\n",i+1,qst[i].a,qst[i].fuhao,qst[i].b); */
}
//ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
int dati()
{
int i; //ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int stuanswer; //ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int count=3; //ÿ<><C3BF><EFBFBD>Ŀɴ<C4BF><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int grade=0; //ѧ<><D1A7><EFBFBD>ɼ<EFBFBD>
for(i=0;i<10;i++)
{
printf("<EFBFBD><EFBFBD>%d<><64>Ϊ<EFBFBD><CEAA>%d%c%d=\n",i+1,qst[i].a,qst[i].fuhao,qst[i].b);
scanf("%d",&stuanswer);
if(stuanswer==qst[i].rezult)
printf("<EFBFBD><EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>\n");
while(stuanswer!=qst[i].rezult&&count>0)
{
printf("<EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
count--;
if(count==0)
break;
printf("<EFBFBD><EFBFBD><EFBFBD>%d<>λ<EFBFBD><CEBB><EFBFBD>\n",count);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD>: ");
scanf("%d",&stuanswer);
}
switch(count)
{
case 0:
printf("<EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>еõ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ %d\n",qst[i].rezult); break;
case 1:
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD>Ϊ5<EFBFBD><EFBFBD>\n"); grade+=5; break;
case 2:
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD>Ϊ7<EFBFBD><EFBFBD>\n"); grade+=7; break;
case 3:
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD>Ϊ10<EFBFBD><EFBFBD>\n"); grade+=10; break;
}
printf("<EFBFBD><EFBFBD>Ŀǰ<EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD>Ϊ%d\n\n",grade);
count=3; //<2F><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
return grade; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ճɼ<D5B3><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void pingjia()
{
int grade;
grade=dati();
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD>Ϊ%d\n",grade);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۣ<EFBFBD>\n");
grade/=10;
switch(grade){
case(10):
case(9):
printf("SMART\n"); break;
case(8):
printf("GOOD\n"); break;
case(7):
printf("OK\n"); break;
case(6):
printf("PASS\n"); break;
default:
printf("TRY AGAIN\n"); break;
}
}