标签:bsp src main time inf i++ div bre info
#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("\n输入数量:");
scanf("%d",&j);
printf("\n输入类型(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=\t\t",d,c);
else
printf("%d/%d=\t\t",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=\t\t",b);
}
break;
}
break;
}
}while(n!=-1);
}
关于含真分数的运算
标签:bsp src main time inf i++ div bre info
原文地址:https://www.cnblogs.com/grrd17s/p/9757641.html