//Diego Martinez CSC5 Chapter 3, P. 146,#15
/*******************************************************************************
* Studying with a Math Tutor
* ______________________________________________________________________________
* This program is designed as a simple math tutor for young students to practice
* addition.
*
* Computation is based on the Formula:
* num1 = the first random number
* num2 = the second random number
* sum = the result of adding num1 and num2
*_______________________________________________________________________________
* INPUT
* User Inputs
*
* OUTPUT
* Addition problem display
* Correct answer display
*******************************************************************************/
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
int num1, num2, sum;
// Seed the random number generator
srand(time(0));
// Generate two random numbers (0–999)
num1 = rand() % 1000;
num2 = rand() % 1000;
// Calculate the sum
sum = num1 + num2;
// Display the problem
cout << "Solve the following problem:\n\n";
cout << " " << num1 << endl;
cout << "+ " << num2 << endl;
// Pause until the student is ready
cout << "\nPress Enter to see the answer...";
cin.get();
// Display the correct answer
cout << "\n " << num1 << endl;
cout << "+ " << num2 << endl;
cout << "-----\n";
cout << " " << sum << endl;
return 0;
}