- #include<stdio.h>
- #include<time.h>
- #include<stdlib.h>
- int f1(int k1,int k2)
- {srand(time(NULL));
- k1=1+rand()%9;
- k2=1+rand()%9;
- printf("%d*%d\n",k1,k2);
- return 0;
- }
- int f2(int k1,int k2)
- {srand(time(NULL));
- k1=1+rand()%99;
- k2=1+rand()%9;
- printf("%d*%d\n",k1,k2);
- return 0;
- }
- int f3(int k1,int k2)
- {srand(time(NULL));
- k1=1+rand()%99;
- k2=1+rand()%99;
- printf("%d*%d\n",k1,k2);
- return 0;
- }
- void g()
- {int k;
- srand(time(NULL));
- k=1+rand()%3;
- if(k==1) printf("Very Good\n");
- if(k==2) printf("excellent\n");
- if(k==3) printf("keep up\n");
- }
- void h()
- {int k;
- srand(time(NULL));
- k=1+rand()%3;
- if(k==1) printf("no,please try again\n");
- if(k==2) printf("no,try once more\n");
- if(k==3) printf("no,keep trying\n");
- }
- void main()
- {int k1,k2,n,m;
- printf("选择两个个位数乘法输入1,选择一个十位数与一个个位数乘法输入2,选择两个个位数乘法输入3\n");
- scanf("%d",&n);
- if(n==1)
- f1(k1,k2);
- if(n==2)
- f2(k1,k2);
- if(n==3)
- f3(k1,k2);
- scanf("%d",&m);
- if(m==(k1*k2))
- g();
- if(m!=(k1*k2))
- {printf("答案是%d\n",k1*k2);
- h();}
- }
复制代码
|
|