#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int x, y, z, m, k, c, i, f=0;
srand((unsigned)time(NULL));
for( i=0; i<10; i++ )
{
z = rand() % 21;
x = rand() % z+1;
y = z - x;
m = rand() % 2;
if (m==0)
{
printf("%d + %d = ", x, y);
k = z;
}
else
{
printf("%d - %d = ", z, x);
k = y;
}
scanf("%d", &c);
if(c==k)
{
f += 10;
printf("回答正确\n");
}
else
{
printf("回答错误\n");
}
}
printf("得分:%d",f);
return 0;
}