//Amari Mosley CSC5 Chapter 3, P. 143, #15
//
/**************************************************************
*
* Math Tutor
* ____________________________________________________________
* This program can be used as a math tutor for a young student.
*
The formula for sum is as follows:
Sum = num1 + num2
* ____________________________________________________________
* INPUT
* User pressing 'Enter' to reveal the answer
* OUTPUT
* Two random numbers and their sum
*
**************************************************************/
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
using namespace std;
// Defining Main Function
int main() {
// Define variables to hold the two random numbers and the sum
int num1, num2, sum;
// Get the system time to use as the seed for the random number generator
unsigned seed = time(0);
// Seed the random number generator
srand(seed);
// Generate two random 3-digit numbers (between 100 and 999)
num1 = (rand() % 900) + 100;
num2 = (rand() % 900) + 100;
// Calculate the sum
sum = num1 + num2;
// Display the problem formatted as requested[cite: 5]
cout << setw(5) << num1 << endl;
cout << "+" << setw(4) << num2 << endl;
cout << "-----" << endl;
// Pause the program while the student works on the problem[cite: 5]
cout << "\nPress Enter when you are ready to check your answer...";
cin.get();
// Display the problem again along with the correct solution[cite: 5]
cout << "\n";
cout << setw(5) << num1 << endl;
cout << "+" << setw(4) << num2 << endl;
cout << "-----" << endl;
cout << setw(5) << sum << endl;
return 0;
}