标签:ase end case 运算 else clu srand std lse
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
int x,y,z,t;
srand(time(NULL));
printf("二柱子的计算题:\n");
for(int i=0;i<30;i++)
{
x=rand()%100;
y=rand()%100;
z=rand()%4;
switch(z)
{
case 0:
printf("%d+%d=\n",x,y);
break;
case 1:
if(x<y)
{
t=x;
x=y;
y=t;
}
printf("%d-%d=\n",x,y);
break;
case 2:
printf("%d×%d=\n",x,y);
break;
case 3:
if(y!=0)
{
printf("%d÷%d=\n",x,y);
}
else
{
i=i-1;
}
break;
default:
printf("超出测试范围\n");
break;
}
}
printf("endl.\n");
return 0;
}
标签:ase end case 运算 else clu srand std lse
原文地址:https://www.cnblogs.com/yanyu123/p/10252723.html