//Charlotte Davies-Kiernan CS1A Chapter 3 P. 146 #15
//
/*****************************************************************************
*
* Display Addition Practice
* ___________________________________________________________________________
* This program help tutor the user, giving the user time to answer and then
* displaying the correct answer on the screen
*
* The program will use the formual:
* sum = first number + second number
* __________________________________________________________________________
* INPUT
* num1 //first random number given to user
* num2 //second random number given to user to add to the first
*
* OUTPUT
* sum //total of number 1 and 2 added together
****************************************************************************/
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <limits>
using namespace std;
int main()
{
int num1; //INPUT - first random number given to user
int num2; //INPUT - second random number given to user to add to the first
int sum; //OUTPUT - total of number 1 and 2 added together
//
// Generate two random numbers
srand(static_cast<unsigned int>(time(0)));
num1 = rand() % 900 + 100;
num2 = rand() % 900 + 100;
//
// Display the math problem for the user
cout << "Solve the following additional problem:\n";
cout << " " << num1 << endl;
cout << "+ " << num2 << endl;
//
// Pause and wait for user to press Enter
cout << "\nPress Enter when you're ready to see the answer...";
cin.ignore(numeric_limits<streamsize>::max(), '\n');
//
// Display the answer
sum = num1 + num2;
cout << "\nHere is the correct answer:\n\n";
cout << " " << num1 << endl;
cout << "+ " << num2 << endl;
cout << "------\n";
cout << " " << sum << endl;
return 0;
}