c语言小学生算术测验程序设计,用C语言编辑程序:教小学生学算术。

满意答案

dcebd7a0de6265b6ccae5ead692f1eab.png

noir_black

2013.06.17

dcebd7a0de6265b6ccae5ead692f1eab.png

采纳率:54%    等级:11

已帮助:4510人

#include

#include

#include

#include

int n;

void voice(void);

void welcome_text();

void c_text();

int gwjj();

int swjj();

int gwcc();

int swcc();

int szhh();

void graph()

{ clrscr();

textcolor(YELLOW);

gotoxy(10,10);

cprintf("*********************************************************");

gotoxy(10,11);

cprintf("*");

gotoxy(10,12);

cprintf("*");

gotoxy(10,13);

cprintf("*");

gotoxy(10,14);

cprintf("*");

gotoxy(10,15);

cprintf("*");

gotoxy(10,16);

cprintf("*");

gotoxy(10,17);

cprintf("*");

gotoxy(10,18);

cprintf("**********************************************************");

gotoxy(67,10);

cprintf("*");

gotoxy(67,11);

cprintf("*");

gotoxy(67,12);

cprintf("*");

gotoxy(67,13);

cprintf("*");

gotoxy(67,14);

cprintf("*");

gotoxy(67,15);

cprintf("*");

gotoxy(67,16);

cprintf("*");

gotoxy(67,17);

cprintf("*");

}

void choose()

{textcolor(RED);

gotoxy(25,11);

cprintf("Welcome to Pupil's CAI System");

textcolor(11);

gotoxy(35,12);

cprintf("MENU");

textcolor(WHITE);

gotoxy(11,13);

cprintf("Ge wei jia jian(press 1)");

gotoxy(39,13);

cprintf("Shi wei jia jian(press 2)");

gotoxy(11,15);

cprintf("Ge wei cheng chu(press 3)");

gotoxy(39,15);

cprintf("Shi wei cheng chu(press 4)");

gotoxy(27,17);

cprintf("si ze hun he (press 5)");

}

void main()

{ int c,l1,l2,l3,l4,l5;

graph();

choose();

printf("\r\n\n\n\n");

scanf("%d",&c);

switch(c)

{case 1:clrscr();l1=gwjj();if(l1==0) break;

case 2:clrscr();l2=swjj();if(l2==0) break;

case 3:clrscr();l3=gwcc();if(l3==0) break;

case 4:clrscr();l4=swcc();if(l4==0) break;

case 5:clrscr();l5=szhh();if(l5==0) break;

}

graph();

choose();

}

int gwjj()

{ int k1,k2,k,t=0,f=0,p,v,l1,a;

welcome_text();

printf("how many subject do you want to do?\n");

scanf("%d",&n);

do

{for(p=0;p

{ k1=rand()%10;

k2=rand()%10;

if(rand()%2)

printf("%d+%d= ",k1,k2);

else

{if(k1

printf("%d-%d= ",k1,k2);

k2=-k2;

}

scanf("%d",&k);

if(k==k1+k2)

{t++;printf("Very good,you are right!\n");}

else

{f++;

printf("Sorry,you answer is wrong,you could input again:");voice();

scanf("%d",&k);

if(k!=k1+k2)

{k=k1+k2;

printf("The answer is:%d\n",k);

}

else

printf("Now you answer is true\n");

}

}

v=(t/n)*100;

if(v>=80)

{ c_text();

scanf("%d",&l1);

if(l1==1)return 1;

else return 0;

}

else

{printf("You should try again,are you?1 yes,0 no\n");

scanf("%d",&l1);

if(l1==1)continue;

else

return 0;

}

}while(1);

}

int swjj()

{int k1,k2,k,t=0,f=0,v,p,l2,a;

welcome_text();

printf("how many subject do you want to do?\n");

scanf("%d",&n);

do

{ for(p=0;p

{k1=rand()%100;

k2=rand()%100;

if(rand()%2)

printf("%d+%d= ",k1,k2);

else

{ if(k1

printf("%d-%d= ",k1,k2);

k2=-k2;

}

scanf("%d",&k);

if(k==k1+k2)

{t++;printf("Very good,you are right!\n"); }

else

{f++;

printf("Sorry,you answer is wrong,you could input again:");voice();

scanf("%d",&k);

if(k!=k1+k2)

{k=k1+k2;

printf("The answer is:%d\n",k);

}

else

printf("Now your answer is true!\n");

}

v=(t/n)*100;

if(v>=80)

{c_text();

scanf("%d",&l2);

if(l2==1)return 1;

else return 0;

}

else

{printf("You should try again,are you?1 yes,2 no\n");

scanf("%d",&l2);

if(l2==1)continue;

else

return 0;

}

}

}while(1);

}

int gwcc()

{int k1,k2,k,t=0,f=0,v,p,l3,a=0;

welcome_text();

printf("how many subject do you want to do?\n");

scanf("%d",&n);

do

{for(p=0;p

{k1=rand()%10;

k2=rand()%10;

if(rand()%2)

printf("%d*%d= ",k1,k2);

else

{k2=k2+1;

k1=k1*k2;

printf("%d/%d= ",k1,k2);

a=1;

}

scanf("%d",&k);

if(a==0)

{if(k==k1*k2)

{t++;printf("Very good,you are right!\n");}

else

{f++;

printf("Sorry,you answer is wrong,you could input again:");

voice();

scanf("%d",&k);

if(k!=k1*k2)

{k=k1*k2;

printf("The answer is:%d\n",k);

}

else

printf("Now your answer is true!\n");

}

}

else

{if(k==k1/k2){t++;printf("Very good,you are right!\n");}

else

{ f++;

printf("Sorry,you answer is wrong,you could input again:");

voice();

scanf("%d",&k);

if(k!=k1/k2)

{k=k1/k2;

printf("The answer is:%d",k);

}

else

printf("Now your answer is true!\n");

}

}

}

v=(t/n)*100;

if(v>=80)

{c_text();

scanf("%d",&l3);

if(l3==1) return 1;

else return 0;

}

else

{printf("You should try again,are you?1 yes,0 no\n");

scanf("%d ",&l3);

if(l3==1)continue;

else

{return 0;}

}

}while(1);

}

int swcc()

{ int k1,k2,k,t=0,f=0,p,v,l4,a=0;

welcome_text();

printf("how many subject do you want to do?\n");

scanf("%d",&n);

do

{ for(p=0;p

{

k1=rand()%100;

k2=rand()%100;

if(rand()%2)

printf("%d*%d= ",k1,k2);

else

{k2=k2+1;

k1=k2*k1;

printf("%d/%d= ",k1,k2);

a=1;

}

scanf("%d",&k);

if(a==0)

{if(k==k1*k2)

{t++;printf("Very good,you are right!\n");}

else

{f++;

printf("Sorry,you answer is wrong,you could input again:");

voice();

scanf("%d",&k);

if(k==k1*k2)

{k=k1*k2;

printf("The anwser is:%d",k);

}

else

printf("Now your answer is true!\n");

}

}

else

{

if(k==k1/k2)

{t++;printf("True\n");}

else

{f++;printf("Wrong\n");voice();}

}

}

v=(t/n)*100;

if(v>=80)

{c_text();

scanf("%d",&l4);

if(l4==1) return 1;

else return 0;

}

else

{printf("You should try again,are you?1 yes,0 no\n");

scanf("%d",&l4);

if(l4==1)continue;

else

return 0;

}

}while(1);

}

int szhh()

{ int k1,k2,t=0,f=0,p,v,k,x,l5;

printf("How many subject do you want to do?/n");

scanf("%d",&n);

do

{ for(p=0;p

{k1=rand()%10;

k2=rand()%10;

if(rand()%2)

{printf("%d*%d-%d= ",k1,k2,k1);

scanf("&d",&k);

if(k==k1*k2-k1)

{t++;printf("Very good,you are right!\n"); }

else

{f++;

printf("sorry,your answer is wrong,you could input again:");

scanf("%d",&k);

if(k!=k1*k2-k1)

{x=k1*k2-k1;

printf("The answer is:%d\n",x);

}

else

{printf("Now your answer is true\n");}

}

}

else

{if(k1>k2)

{k2=k2+1;

k1=k2*k1;

printf("%d+%d/%d= ",k2,k1,k2);

scanf("%d",&k);

if(k==k2+k1/k2)

{t++;printf("Very good,you are right!\n");}

else

{f++;

printf("Sorry,your answer is wrong,you could input again:");

scanf("%d",&k);

if(k!=k2+k1/k2)

{x=k2+k1/k2;

printf("the answer is:%d\n",x);

}

else

{printf("This time your answer is true\n"); }

}

}

else

{k1=k1+1;

k2=k1*k2;

printf("%d-%d/%d= ",k2,k2,k1);

scanf("%d",&k);

if(k==k2-k2/k1)

{t++;printf("Very good,you are right!\n");}

else

{f++;

printf("Sorry,your answer is wrong,you could input again:");

scanf("%d",&k);

if(k!=k2-k2/k1)

{x=k2-k2/k1;

printf("The answer is:%d\n",x);

}

else

{printf("This time your answer is true\n");}

}

}

}

}

v=(t/n)*100;

if(v>=80)

{c_text();

scanf("%d",&l5);

if(l5==1) return 1;

else return 0;

}

else

{printf("You should try again,are you?1 yes,0 no\n");

scanf("%d ",&l5);

if(l5==1)continue;

else

{return 0;}

}

}while(1);

}

void voice()

{sound(500);

delay(100000);

nosound();

}

void welcome_text()

{textcolor(RED);

gotoxy(2,2);

cprintf("Welcome Here:\r\n");

}

void c_text()

{textcolor(RED);

cprintf("Congratulations,whether go to next step?1 yes,0 no\n");

}

00分享举报

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值