#include
#include
#include
int jia()
{ int num1,num2,num;
system("cls");
srand(time(NULL));
do
{
num1=rand()%100;
num2=rand()%100;
num=num1+num2;
}while(num>100);
printf("%d+%d=",num1,num2);
return num;
}
int jian()
{ int num1,num2,num;
system("cls");
srand(time(NULL));
do
{
num1=rand()%100;
num2=rand()%100;
num=num1-num2;
}while(num>100||num<0);
printf("%d-%d=",num1,num2);
return num;
}
int cheng()
{ int num1,num2,num;
system("cls");
srand(time(NULL));
do
{
num1=rand()%100;
num2=rand()%100;
num=num1*num2;
}while(num>100);
printf("%d*%d=",num1,num2);
return num;
}
main()
{ int a,c,i,n,r;
float aver,grade=0;
srand(time(NULL));
printf("请输入题目数量:");
scanf("%d",&n);
aver=100.0/n; //百分制
for(i=0;i
switch(c)
{
case 0:r=jia();break;
case 1:r=jian();break;
case 2:r=cheng();break;
}
scanf("%d",&a);
if(a==r)
grade+=aver;
}
system("cls");
printf("成绩:%.1f\n",grade);
}