找了很久还是不知道问题出在哪一步,求教
#include<stdio.h>#include<stdlib.h>
#include<time.h>
int main()
{
int a,b,numOfQues=0,numOfRight=0;
char inquiry;
srand(time(NULL));
printf("欢迎你来做两位数的加减法\n");
do
{
int temp=rand()%2;
a=rand()%100;
b=rand()%100;
switch(temp)
{
case 0:
{
int ans;
printf("%d+%d=",a,b);
scanf("%d",&ans);
if(ans==a+b);
{
numOfRight++;
printf("恭喜!答对了!\n");
}
else
printf("错了");
}
break;
}
case 1:
{
int ans;
printf("%d-%d=",a,b);
scanf("%d",&ans);
if(ans==a-b);
{
numOfRight++;
printf("恭喜!答对了!\n");
}
else
printf("错了\n");
}
break;
}
numOfQues++;
printf("再来一题吗");
fflush(stdin);
inquiry=getchar();
}
while(inquiry==!'n'||inquiry==!'N');
printf("你的答题正确率为%.2lf%%,再见!\n",numOfRight*100./numOfQues);
return 0;
}