#include<stdio.h>
#define W 5
main()
{
int a,b,i=0,c,d,r=0;
while(i<W)
{
i++;
srand(time());
a=rand()%10+1;
b=rand()%10+1;
c=rand()%5+1;
switch(c)
{
case 1:printf("%d+%d=",a,b);
scanf("%d",&d);
if(d!=a+b)
printf("回答错误!\n");
else
r++;
break;
case 2:printf("%d-%d=",a,b);
scanf("%d",&d);
if(d!=a-b)
printf("回答错误!\n");
else
r++;
break;
case 3:printf("%d*%d=",a,b);
scanf("%d",&d);
if(d!=a*b)
printf("回答错误!\n");
else
r++;
break;
case 4:printf("%d/%d=",a,b);
scanf("%d",&d);
if(d!=a/b)
printf("回答错误!\n");
else
r++;
break;
}
}
printf("\n\n共答对%d题\n",r);
}