/**
Cheng Peng Far
Title: 30-Way 2-Age arithmetic topics
Requirements: Subtraction result is not negative, division can be divided evenly, divisor is not 0;
*/
#include <iostream.h>
#include <stdlib.h>
int main ()
{
int a,b,c;
for (int i=0;i<30;i++)
{
"cout<<" <<i+1<< "title:";
A=rand ()%100;//x+rand ()% (y-x+1) randomly generates integers in "x, Y"
B=rand ()%100;
C=rand ()%4;
Switch (c)
{
Case 1:
cout<<a<< "+" <<b<< "=" <<endl;
Break
Case 2:
if (a>b) {cout<<a<< "-" <<b<< "=" <<ENDL;}
else{cout<<b<< "-" <<a<< "=" <<ENDL;}
Break
Case 3:
cout<<a<< "*" <<b<< "=" <<endl;
Break
Case 0:
int j=0;
while ((j<100000) && (a!=0) && (b!=0) && (a%b==0)) {cout<<a<< "/" <<b< < "=" <<endl;i++;j++;}
if ((a!=0) && (b!=0) && (a%b==0)) {cout<<a<< "/" <<b<< "=" <<endl;i++;}
else{
int j=0;
while (j<100000)
{
A=rand ()%1000;//x+rand ()% (y-x+1) randomly generates integers in "x, Y"
B=rand ()%100;
if ((a!=0) && (b!=0) && (a%b==0)) {cout<<a<< "/" <<b<< "=" <<endl;i++;j= 100000;j++;}
else{j++;}
}
}
Break
}
}
return 0;
}
The first upgrade of the 30-course arithmetic problem