Multiplication Exercise * 10

  1. Repeat the previous multiplication exercise 10 times.
  2. However, if the user answers correctly, you need not say anything. Only tell the correct answer when the user gives an incorrect answer.
  3. Count how many questions the user answers incorrectly. At the end of the exercise, tell the user how many mistakes he/she made.
  4. If you want to measure the elapsed time, you may call the time() function.
    
    #include <iostream>
    using std::cout;
    using std::cin;
    
    int main()
    {
        unsigned int t0, t1;
        int n;
        t0 = time(NULL);
        cout << "Please input an integer -- ";
        cin >> n;
        t1 = time(NULL);
        cout << t1 - t0 << " seconds has elapsed.\n";
        return 0;
    }
    
    
  5. If want the program to generate different random numbers at each run, supply a different random seed at the beginning of the program.
    
    #include <iostream>
    #include <cstdlib>
    using std::cout;
    using std::endl;
    
    int main()
    {
        srand(time(NULL));
        for (int i=0; i<10; ++i)
            cout << rand() % 6 << endl;
        return 0;
    }
    
    

The program may run as follows:

19 * 19 = 361
72 * 6 = 432
64 * 12 = 768
85 * 57 = 4845
16 * 83 = 1328
65 * 9 = 858
Wrong! 65*9=585
80 * 36 = 2880
14 * 92 = 1288
27 * 65 = 1755
33 * 4 = 133
Wrong! 33*4=132
You made 2 mistakes today.

The flowchart of the program: