#include <stdlib.h>
#include <time.h>
int main()
{
int a,b,i,s,num,n=0;
char ch,cal[4]={'+','-','*','/'};
srand(time(NULL));
for(i=0;i<10;i++)
{
a=rand()%10+1;
ch=cal[rand()%4];
b=rand()%10+1;
printf("%d%c%d=",a,ch,b);
switch(ch)
{
case '+':s=a+b;break;
case '-':s=a-b;break;
case '*':s=a*b;break;
case '/':s=a/b;break;
}
scanf("%d",&num);
if(num==s)
{
printf("Right!\n");
n++;
}
else printf("Wrong!\n");
}
printf("总分: %d\n正确率: %%%d",n*10,n*10);
return 0;
}
追问![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/7c1ed21b0ef41bd549fe399c5cda81cb39db3d2d?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
大佬 我按照你发的改了下 任务四可以了 可以指点一下任务五嘛
![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/a2cc7cd98d1001e9b39dc567b50e7bec54e79731?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)