Ideas: (1) generate two random numbers within 1-100 and randomly arithmetic;
(2) The loop is carried out 30 times, producing 30 questions;
(3) in the second grade, did not learn the score and negative, the meiosis is less than or equal to be meiosis.
SOURCE program code:
#include "stdafx.h"
#include "iostream.h"
#include "Stdlib.h"
#include "math.h"
#include "time.h"
int main (int argc, char* argv[])
{
int A, B;
int m;
Srand ((unsigned) time (NULL));
for (int i=1;i<=30;i++)
{
A=rand ()%100;
B=rand ()%100;
M=rand ()%4;
Switch (m)
{
Case 0:
cout<<i<< "" <<a<< "+" <<b<< "=" <<endl;
Break
Case 1:
if (a>=b)
{
cout<<i<< "" <<a<< "-" <<b<< "=" <<endl;
Break
}
Case 2:
cout<<i<< "" <<a<< "x" <<b<< "=" <<endl;
Break
Case 3:
cout<<i<< "" <<a<< "/" <<b<< "=" <<endl;
Break
}
}
return 0;
}
The results are as follows:
30 arithmetic in second grade