include <stdio.h>int main(void){ int i = 0, a, b, ret, user_ret;char symbol; 0(+), 1(-), 2(*), 3(/)int count, right = 0;srand(time(NULL));while (1) { a = rand() % 100; b = rand() % 100;symbol = rand() % 4; switch (symbol) { case 0 : { ret = a + b;symbol = '+'; } break;case 1 : { ret = a - b;symbol = '-';} break;case 2 : { ret = a * b;symbol = '*';} break;case 3 : { ret = a / b;symbol = '/';}}printf("%d%c%d=", a, symbol, b);count = 0;while (1) { scanf("%d", &user_ret);if (user_ret == ret) { printf("回答正确\n");right ++; break; }printf("错误,再次输入:");count++; // 答错计数+1if (count == 3) { printf("正确答案是:%d\n", ret);break; }}i++; printf("是否继续(y/n)?\n");getchar(); scanf("%c", &symbol);if (symbol != 'y' && symbol != 'Y') break;}printf("练习结束, 共做题%d, 正确%d, 正确率%.2f%%\n", i, right, (double)right / i * 100);return 0;}