100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > 小学生计算机教学辅助系统

小学生计算机教学辅助系统

时间:2022-01-15 15:58:14

相关推荐

小学生计算机教学辅助系统

C语言程序设计(苏小红著)课后题7.14

#include<stdio.h>#include<time.h>#include<stdlib.h>//回答正确提示void rightprint(int remark){switch(remark){case 1:printf("Very good!");break;case 2:printf("Excellent!");break;case 3:printf("Nice work!");break;case 4:printf("Keep up the good work!"); break;}printf("Right!\n");}//回答错误提示void errorprint(int remark){switch(remark){case 1:printf("No.Please try again.");break;case 2:printf("Wrong.try once more.");break;case 3:printf("Don't give up!");break;case 4:printf("Not correct.Keep trying."); break;}printf("Wrong!Please try again.\n");}int main(void){////任务一//int cx,bcx,answer,count=0;//srand(time(NULL));//cx=rand()%10+1;//srand(clock());//bcx=rand()%10+1;//printf("%d*%d",cx,bcx);//while(true)//{//printf("\n输入算式答案:");//scanf("%d",&answer);//count++;//if(answer==cx*bcx)//{//printf("回答正确");//break;//}else{////任务二//if(count==3){//printf("三次未能答对,测试结束");//break;//}//printf("回答错误,请重新回答:");//}//}//任务三 ,任务四,任务五,任务六int cx,bcx,answer,count=0,right=0,wrong=0,sign,remark;//printf("欢迎来到小学生加减乘除练习。-v-\n");do{count=0;right=0;wrong=0;while(count!=10){srand(time(NULL));cx=rand()%10+1;srand(clock());bcx=rand()%10+1;srand(time(NULL));sign=rand()%4+1;srand(clock());remark=rand()%4+1;if(sign==1){count++;printf("number.%d:%d*%d=",count,cx,bcx);//printf("\n输入算式答案:");scanf("%d",&answer);if(answer==cx*bcx){rightprint(remark);right++;}else{errorprint(remark);wrong++;}//除法}if(sign==2){count++;if(bcx>cx){int t=cx;cx=bcx;bcx=t;}while(cx%bcx!=0){bcx--;}printf("number.%d:%d/%d=",count,cx,bcx);//printf("\n输入算式答案:");scanf("%d",&answer);if(answer==cx/bcx){rightprint(remark);right++;}else{errorprint(remark);wrong++;}//减法}if(sign==3){count++;if(bcx>cx){int t=cx;cx=bcx;bcx=t;}printf("number.%d:%d-%d=",count,cx,bcx);//printf("\n输入算式答案:");scanf("%d",&answer);if(answer==cx-bcx){rightprint(remark);right++;}else{errorprint(remark);wrong++;}}//加法if(sign==4){count++;printf("number.%d:%d+%d=",count,cx,bcx);//printf("\n输入算式答案:");scanf("%d",&answer);if(answer==cx+bcx){rightprint(remark);right++;}else{errorprint(remark);wrong++;}}}system("cls");printf("Test over!You score is:%d,your accuracy rate is%2.0f%%\n",right*10,((float)right/10)*100);if(((float)right/10)*100<75){printf("your accuracy rate is not enough 75%,please answer again:\n");}}while(((float)right/10)*100<75);return 0;}

运行结果

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。