#include<stdio.h>
#include<stdlib.h>
#include <time.h>
#define N 30
main()
{
int a,b,c,d,n;
float k,i;
do{
printf("
请输入1.整数 2.小数 3.退出程序: ");
scanf("%d",&n);
switch(n)
{
case 1:
{
for(i=0;i<N;i++)
{
a=rand()%100+1;
b=rand()%100+1;
c=rand()%4+1;
printf("%d",a);
switch(c)
{
case 1:printf("+");break;
case 2:printf("-");break;
case 3:printf("*");break;
case 4:printf("/");break;
}
printf("%d= ",b);
}
break;
}
break;
case 2:
{
for(i=0;i<N;i++)
{
c=rand()*0.001+1;
d=rand()*0.001+1;
k=rand()%4+1;
printf("%0.2f",k);
switch(c)
{
case 1:printf("+");break;
case 2:printf("-");break;
case 3:printf("*");break;
case 4:printf("/");break;
}
printf("%0.2f= ",i);
}
break;
}
break;
}
}while(n!=3);
}