//Zachary Abdollahi CS1A Chapter 3, P. 146, #15
//
/*******************************************************************************
*
* BEHAVING AS MATH TUTOR
* _____________________________________________________________________________
*
* This program acts as a math tutor for a student. It displays two random
* numbers to be added, pauses while the student works on the problem, then
* displays the problem again along with the correct solution when the student
* is ready.
*
* Computation is based on the formula:
* Sum = Number1 + Number 2
* _____________________________________________________________________________
*
* INPUT
* number1, number2: Randomly generated numbers to add
*
* OUTPUT
* sum : Sum of number1 and number2
*
******************************************************************************/
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
using namespace std;
int main ()
{
int number1; //INPUT - First random number
int number2; //INPUT - Second random number
int sum; //OUTPUT - Sum of number1 and number2
//
// Seed Random Number Generator and Generate Numbers
srand(static_cast<unsigned int>(time(0)));
number1 = rand() % 900 + 100; //Random 3-digit number (100-999)
number2 = rand() % 900 + 100; //Random 3-digit numeber (100-999)
//
// Display Problem For Student
cout << " " << number1 << endl;
cout << "+ " << number2 << endl;
cout << "-----" << endl;
//
// Pause While Student Works on Problem
cout << endl << "Work on the problem, then press Enter to see the answer...";
cin.get();
// Compute Sum
sum = number1 + number2;
//
// Output Result
cout << endl << " " << number1 << endl;
cout << "+ " << number2 << endl;
cout << "-----" << endl;
cout << " " << sum << endl;
return 0;
}