Programming Ideas:
Because it is a junior arithmetic problem, I consider some 100 within the subtraction, but also randomly generated, so with the RAND function, and selectively use the switch case structure, to 30 questions of disorder. And the specifics of subtraction and division are considered.
Source:
#include <iostream.h>
#include <stdlib.h>
int main () {
int a,b,c;
for (int i=1;i<31;i++) {
A=rand ()%100;
B=rand ()%100;
C=rand ()%4;
Switch (c) {
Case 0:
cout<<i<< "" <<a<< "+" <<b<< "=" <<endl;
Break
Case 1:
if (a>b)
{
cout<<i<< "" <<a<< "-" <<b<< "=" <<endl;
}
Else
{
cout<<i<< "" <<b<< "-" <<a<< "=" <<endl;
}
Break
Case 2:
cout<<i<< "" <<a<< "*" <<b<< "=" <<endl;
Break
Case 3:
if (b!=0)
{
cout<<i<< "" <<a<< "/" <<b<< "=" <<endl;
}
Else
{
cout<< "This problem is wrong! "<<endl;
}
Break
}
}
return 0;
}
Operation Result:
Random generation of 30-channel arithmetic problem programming