#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int mks(void)
{
int a,b,c,i;
a=rand()%10+1;
b=rand()%10+1;
for (i = 0; i<3; i++) {
printf("%d+%d=?\n",a,b);
scanf("%d",&c);
if (c==a+b) {
puts("Good!");
return 10;
}
else if (i<1) puts("Wrong,Try Again!");
else if (i==2) puts("Sorry! you're still wrong!");
else puts("Wrong, Last Chance!");
}
return 0;
}
int main(void)
{
int i,soc;
srand(time(NULL));
for (soc=i = 0; i < 10; i++) {
printf("**********No. %d**********\n",i+1);
soc+=mks();
}
puts("************* Score *************");
printf("%d\n",soc);
return 0;
}
温馨提示:内容为网友见解,仅供参考