#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int n,m,j;
printf(“请输入题的个数:”);
scanf("%d",&n);
while(n–)
{
int a=rand()%10+1;
int b=rand()%10+1;
int c=rand()%4;
switch©
{
case 0:printf("%d+%d=",a,b);break;
case 1:printf("%d*%d=",a,b);break;
case 2:printf("%d-%d=",a,b);break;
case 3:printf("%d/%d=",a,b);break;
}
scanf("%d",&j);
switch©
{
case 0:m=a+b;break;
case 1:m=a*b;break;
case 2:m=a-b;break;
case 3:m=a/b;break;
}
if(j==m)
printf(“答案正确”);
else
printf(“答案错误”);
printf("\n\n");
}
}
C语言小学生四则运算随机出题35行代码搞定!!!!!!
猜你喜欢
转载自blog.csdn.net/TIMEINAHURRY/article/details/104804484
今日推荐
周排行