标签:ret def ++ include and turn lib switch 范围
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
int x,y,z,t,i;
srand(time(NULL));
printf("三十道四则运算题\n");
for(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("完成\n");
return 0;
}
标签:ret def ++ include and turn lib switch 范围
原文地址:https://www.cnblogs.com/YSong666/p/9756386.html