#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define N j
main()
{
int a,b,k,i,n,c,d,e,f,j;
do{
printf("
请输入数量:");
scanf("%d",&j);
printf("
请输入类型(1.真分数 2.整数)");
scanf("%d",&n);
switch(n)
{
case 1:
{
for(i=0;i<N;i++)
{
e=rand()%100+1;
f=rand()%100+1;
k=rand()%4+1;
if(e>=f)
printf("%d/%d",f,e);
else
printf("%d/%d",e,f);
switch(k)
{
case 1:printf("+");break;
case 2:printf("-");break;
case 3:printf("*");break;
case 4:printf("/");break;
}
c=rand()%100+1;
d=rand()%100+1;
if(c>=d)
printf("%d/%d= ",d,c);
else
printf("%d/%d= ",c,d);
}
break;
}
break;
case 2:
{
for(i=0;i<N;i++)
{
a=rand()%100+1;
b=rand()%100+1;
k=rand()%4+1;
printf("%d",a);
switch(k)
{
case 1:printf("+");break;
case 2:printf("-");break;
case 3:printf("*");break;
case 4:printf("/");break;
}
printf("%d= ",b);
}
break;
}
break;
}
}while(n!=-1);
}