您好,欢迎访问三七文档
C语言程序设计报告日期:2222年11月2日实验名称小学生计算机辅助教学系统学校学院专业指导教师范江波实验人姓名学号程序功能帮助小学生通过计算机学习乘法,提高效率,并及时发现错误,改正错误,通过不断的练习,提高小学生的算数水平要求(1)整个系统均用C语言实现;(2)程序设计计量清晰明了;(3)系统具有输入、显示、提示和修改基本功能;(4)系统的各个功能模块都用函数的形式来实现程序主要内容任务1.程序首先随机产生一到十之间的正整数,在屏幕上打印出问题,例如6*7=?然后让学生输入答案,序检查学生输入的答案是否正确,若正确,则“RIGHT”,然后问下一个问题,否则打印“WRONG,PLEASETRYAGAIN”,然后提示学生重做,直到答对为止。程序如下:#includetime.h#includestdlib.h#includestdio.hintMagic(intx);intAnswer();main(){intguess,answer,counter=1;do{printf(%d*%d=,Magic(1),Magic(2));answer=Magic(1)*Magic(2);if(Answer()==answer){printf(Right\n);break;}elseprintf(Wrong!,pleasetryagain\n);}while(counter=1);}intMagic(intm){intx,inty;srand(time(NULL));x=rand()%10+1;y=rand()%10+1;if(m==1)returnx;if(m==2)returny;}intAnswer(){intn;scanf(%d,&n);returnn;}任务2:在(1)的基础上,当学生回答错误时,最多给三次重做的机会。:程序如下:#includetime.h#includestdlib.h#includestdio.hintMagic(intx);intAnswer();intExam();main(){intn;n=Exam();if(n==0)printf(Right\n);elseif(n==1)printf(Wrong!Youhavetriedthreetimes!Testover\n);}intMagic(intm){intx,inty;srand(time(NULL));x=rand()%10+1;y=rand()%10+1;if(m==1)returnx;if(m==2)returny;}intAnswer(){intn;scanf(%d,&n);returnn;}intExam(){intguess,answer,counter=1;do{printf(%d*%d=,Magic(1),Magic(2));answer=Magic(1)*Magic(2);counter++;if(Answer()==answer)return0;elseif(counter=3)printf(Wrong!pleasetryagain\n);}while(counter=3);return1;任务3:在(1)的基础上,连续做10道乘法运算题,不给机会重做,若学生回答正确,提示“RIGHT”,否则提示“WRONG”,并按每题10分输出总分,再输出正确概率。程序如下:#includetime.h#includestdlib.h#includestdio.hintMagic(intx);intAnswer();intExam();main(){printf(rate=%d%%\n,Exam());}intMagic(intm){intx,inty;srand(time(NULL));x=rand()%10+1;y=rand()%10+1;if(m==1)returnx;if(m==2)returny;}intAnswer(){intn;scanf(%d,&n);returnn;}intExam(){intanswer,counter=1;inti=0;do{printf(%d*%d=,Magic(1),Magic(2));answer=Magic(1)*Magic(2);counter++;if(Answer()==answer){printf(Right!\n);i++;}elseprintf(Wrong!\n);}while(counter=10);i=i*10;returni;}任务4:在(3)的基础上,随机产生10道四则运算题,运算类型为随机的加减乘除任意一种,不给机会重做,若学生回答正确,提示“RIGHT”,否则提示“WRONG”,并按每题10分输出总分,再输出正确概率。程序如下:#includetime.h#includestdlib.h#includestdio.hintMagic(intx);intAnswer();intExam();main(){printf(rate=%d%%\n,Exam()*10);}intMagic(intm){intx,inty;srand(time(NULL));x=rand()%10+1;y=rand()%10+1;if(m==1)returnx;if(m==2)returny;}intAnswer(){intn;scanf(%d,&n);returnn;}intExam(){intcounter=1,answer,i=0;chara;do{srand(time(NULL));END:a=rand()%100+1;if(a==43){printf(%d%c%d=,Magic(1),a,Magic(2));answer=Magic(1)+Magic(2);}elseif(a==45){printf(%d%c%d=,Magic(1),a,Magic(2));answer=Magic(1)-Magic(2);}elseif(a==42){printf(%d%c%d=,Magic(1),a,Magic(2));answer=Magic(1)*Magic(2);}elseif(a==47){printf(%d%c%d=,Magic(1),a,Magic(2));answer=Magic(1)/Magic(2);}elsegotoEND;counter++;if(Answer()==answer){printf(Right!\n);i++;}elseprintf(Wrong!\n);}while(counter=10);returni;任务5:在(4)的基础上,在学生完成10道题后,若正确率低于75%,则重新做10道,知道高于75%.程序如下:#includetime.h#includestdlib.h#includestdio.hintMagic(intx);intAnswer();intMakeop();voidComment(intx);main(){intrate;LI:rate=Makeop()*10;printf(rate=%d%%\n,rate);if(rate75){printf(Rightrateistoolow,Again!\n);gotoLI;}}intMagic(intm){intx,inty;srand(time(NULL));x=rand()%10+1;y=rand()%10+1;if(m==1)returnx;if(m==2)returny;}intMakeop(){intcounter=1,answer,i=0,a;charop;do{srand(time(NULL));END:a=rand()%4+1;if(a==1){op=43;answer=Magic(1)+Magic(2);}elseif(a==2){op=45;answer=Magic(1)-Magic(2);}elseif(a==3){op=42;answer=Magic(1)*Magic(2);}elseif(a==4){op=47;answer=Magic(1)/Magic(2);}elsegotoEND;printf(%d%c%d=,Magic(1),op,Magic(2));counter++;if(Answer()==answer){Commen(1);i++;}elseCommen(2);}while(counter=10);returni;}intAnswer(){intn;scanf(%d,&n);returnn;}voidComment(intx){intx,y;srand(time(NULL));x=rand()%4+1;y=rand()%4+1;if(x==1){switch(x){case1:printf(Verygood!\n);break;case2:printf(Excellent!\n);break;case3:printf(Nicework!\n);break;case4:printf(Keepupthegoodwork!\n);break;}}else{switch(y){case1:printf(No.Pleasetryagain!\n);break;case2:printf(Wrong.Tryoncemore!\n);break;case3:printf(Don'tgiveup!\n);break;case4:printf(Notcorrect.Keeptrying!\n);break;}}}任务6:在(5)的基础上,随机产生一个1到4之间的随机数,配合使用switch语句,printf()函数调用,来为学生输入的每一个答案输出不同的评价。程序如下:.#includetime.h#includestdlib.h#includestdio.hintMagic(intm);intAnswer();intMakeop();voidComment(intr);main(){intrate;LI:rate=Makeop()*10;printf(rate=%d%%\n,rate);if(rate75){printf(Rightrateistoolow,Again!\n);gotoLI;}}intMagic(intm){intx,inty;srand(time(NULL));x=rand()%10+1;y=rand()%10+1;if(m==1)returnx;if(m==2)returny;}intMakeop(){intcounter=1,answer,i=0,a;charop;do{srand(time(NULL));END:a=rand()%4+1;if(a==1){op=43;answer=Magic(1)+Magic(2);}elseif(a==2){op=45;answer=Magic(1)-Magic(2);}elseif(a==3){op=42;answer=Magic(1)*Magic(2);}elseif(a==4){op=47;answer=Magic(1)/Magic(2);}elsegotoEND;printf(%d%c%d=,Magic(1),op,Magic(2));counter++;if(Answer()==answer){Comment(1);i++;}elseComment(2);}while(counter=10);returni;}intAnswer(){intn;scanf(%d,&n);returnn;}voidComment(intr){intx,y;srand(time(NULL));x=rand()%4+1;y=rand()%4+1;if(r==1){switch(x){case1:printf(Verygood!\n);break;case2:printf(Excellent!\n);break;case3:printf(
本文标题:c语言实验报告1
链接地址:https://www.777doc.com/doc-7027956 .html