1. Topics
Time limit 20 minutes to write the program "randomly produce 100 or less of the 30 arithmetic problem."
2. Ideas
The generation of random numbers requires the rand () function, which randomly generates arithmetic with the rand () function,%4.
3. Code
#include <iostream>
#include <cmath>
using namespace Std;
void Main ()
{
int A, b, c,i;
for (i = 1; I <=30; i++)
{
A = rand ()% 99;
b = rand ()% 99;
c = rand ()% 4;
if (c = = 1)
cout <<i<< "," << a << "+" << b << "=" << Endl;
if (c = = 2)
cout << i<< "," <<a << "-" << b << "=" << Endl;
if (c = = 3)
cout <<i<< "," << a << "*" << b << "=" << Endl;
if (c = = 0)
cout << i<< "," <<a << "/" << b << "=" << Endl;
}
}
4, 20 minutes not completed reason
The main idea is not clear enough, too anxious to write, and not the whole process of the idea, simple to say is where to write, write the writing will not go down, in addition to RAND () function familiarity is not enough, after a certain time to think of this function.
20 minutes to Set program, small sense