还有一件事情……53#代码编译不过……
----------------解决方案--------------------------------------------------------
程序代码:
#include<stdio.h>
#include<stdlib.h>
char w[53]={0},op[]="+-*/",*right[]={"你真聪明!","继续保持!","加油!"},*wrong[]={"再想一想,你还有两次机会。","不要着急,要把握住最后一次机会喔!","要加强练习喔!"};int Calc(int* n1,int pn,int* n2){switch(op[pn]){case '+':return *n1+*n2;case '-':return *n1-*n2;case '*':return *n1* *n2;case '/':*n2=rand()%10;*n1=*n2*(rand()%10+1);return *n1/ *n2;}return 0;}int InputNum(){int n;while(scanf("%d",&n)!=1){while(getchar()!='\n');puts("对不起,请重新输入!");}while(getchar()!='\n');return n;}int Practise(int pn){int n1=rand()%100+1,n2=rand()%100+1,ans=Calc(&n1,pn,&n2),i;for(printf("%d %c %d = ?\n",n1,op[pn],n2),i=0;i<3 &&InputNum()!=ans;i++)printf("不正确,%s\n",wrong[i]);if(i==3)printf("正确答案是%d.\n",ans);else printf("正确,%s\n",right[i]);printf("是否继续练习?(Y/N)");return getchar()=='y';}int main(n){for(n=0;n<51;w[n]='*',n++);while(system("cls"),printf("%s\n%11c小学生四则运算练习系统\n%s\n%15c1--加法练习\n%15c2--减法练习\n%15c3--乘法练习\n%15c4--除法练习\n%15c0--退出\n请选择(0--4):",w,' ',w,' ',' ',' ',' ',' '),(n=getchar())!='0')if(n>='1' && n<='4')while(Practise(n-'1'));return 0;}
----------------解决方案--------------------------------------------------------
提示: 作者被禁止或删除 内容自动屏蔽