四则运算

#include <iostream.h>
#include <stdlib.h>
#include <time.h>

int main(void)
{
int i = 0;
srand((unsigned)time(NULL));
while(i<30)
{

int a = rand()%100;
int b = rand()%100;
int j;
j = rand()%4;
cout<<a;
switch(j)
{
case 0:
cout<<"+";
break;
case 1:
cout<<"-";
break;
case 2:
cout<<"*";
break;
case 3:
cout<<"/";
break;
}
cout<<b<<"= ";
i++;
if(i%5==0)
cout<<endl;
}

return 0;
}

原文地址:https://www.cnblogs.com/cuipengbo/p/4320704.html