#include <stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
int n;
printf("请输入想要循环的次数:");
scanf("%d",&n);
for(n;n>0;n--)
{
int a,b,c,d,e,f,h,i;
srand(time(0));
a=rand();
b=rand();
c=rand();
d=a%11;
e=b%11;
f=c%4+1;
if (f==1)
{
printf("计算%d和%d的和",d,e);
h=d+e;
scanf("%d",&i);
if(h==i)
{
printf("Right!\n");
}
else
printf("Not Correct!Try again!\n");
}
if (f==2)
{
printf("计算%d和%d的差",d,e);
h=d-e;
if (h>=0)
{
scanf("%d",&i);
if(h==i)
{
printf("Right!\n");
}
else printf("Not Correct!Try again!\n");
}
}
else if (f==3)
{
printf("计算%d和%d的乘积",d,e);
h=d*e;
scanf("%d",&i);
if(h==i)
{
printf("Right!\n");
}
else printf("Not Correct!Try again!\n");
}
else if (f==4)
{
h=d%e;
if(h==0)
printf("计算%d和%d的商",d,e);
scanf("%d",&i);
if(h==i)
{
printf("Right!\n");
}
else printf("Not Correct!Try again!\n");
}
}
return 0;
}
#include<stdlib.h>
#include<time.h>
int main()
{
int n;
printf("请输入想要循环的次数:");
scanf("%d",&n);
for(n;n>0;n--)
{
int a,b,c,d,e,f,h,i;
srand(time(0));
a=rand();
b=rand();
c=rand();
d=a%11;
e=b%11;
f=c%4+1;
if (f==1)
{
printf("计算%d和%d的和",d,e);
h=d+e;
scanf("%d",&i);
if(h==i)
{
printf("Right!\n");
}
else
printf("Not Correct!Try again!\n");
}
if (f==2)
{
printf("计算%d和%d的差",d,e);
h=d-e;
if (h>=0)
{
scanf("%d",&i);
if(h==i)
{
printf("Right!\n");
}
else printf("Not Correct!Try again!\n");
}
}
else if (f==3)
{
printf("计算%d和%d的乘积",d,e);
h=d*e;
scanf("%d",&i);
if(h==i)
{
printf("Right!\n");
}
else printf("Not Correct!Try again!\n");
}
else if (f==4)
{
h=d%e;
if(h==0)
printf("计算%d和%d的商",d,e);
scanf("%d",&i);
if(h==i)
{
printf("Right!\n");
}
else printf("Not Correct!Try again!\n");
}
}
return 0;
}