當前位置:編程學習大全網 - 編程語言 - 小學生心算CAI系統編程

小學生心算CAI系統編程

#include<stdlib.h>

#include<graphics.h>

#include<conio.h>

#include<stdio.h>

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<n;p++)

{ k1=rand()%10;

k2=rand()%10;

if(rand()%2)

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

else

{if(k1<k2){ a=k2;k2=k1;k1=a;}

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<n;p++)

{k1=rand()%100;

k2=rand()%100;

if(rand()%2)

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

else

{ if(k1<k2){a=k2;k2=k1;k1=a;}

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<n;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<n;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<n;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");

}

  • 上一篇:澳洲技術移民要求的雇主推薦信
  • 下一篇:小米盒子4參數配置和哪個型號最好(網絡機頂盒哪個牌子好)
  • copyright 2024編程學習大全網