rand()%4+1产生1-4的随机整数,1-100:rand()%100+1,很简单
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main()
{
srand((int)time(0));
int m =rand()%100;
int n =rand()%100;
int k =rand()%4+1;
printf("%d %d %d\n",m,n,k);
double res;
switch(k)
{
case 1:
res=m+n;
break;
case 2:
res=m-n;
break;
case 3:
res=m*n;
break;
case 4:
res=(double)m/n;
break;
}
printf("%lf",res);
return 0;
}