//Jeremy Huang CS1A Chapter 3, P. 146, #15
//
/**************************************************************
*
* CALCULATE ADDITION PROBLEM
* ____________________________________________________________
* This program displays an addition problem and pauses until
* it receives an input to display the answer
* ____________________________________________________________
* INPUT
* N/A : Program waits for Enter key to be pressed
*
* OUTPUT
* num1 : first random number
* num2 : second random number
* sum : sum of num1 and num2
*
**************************************************************/
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <iomanip>
using namespace std;
int main() {
srand(time(0));
//Random numbers from 1-500
int num1 = rand() % 401 + 100;
int num2 = rand() % 401 + 100;
//Calculate answer
int sum = num1 + num2;
//Display addition problem
cout<<"Here is a math problem to solve:\n\n";
cout<<setw(5)<<num1<<endl;
cout<<"+ "<<setw(3)<<num2<<endl;
cout<<"-----\n"<<endl;
//Prompt user to press Enter when ready
cout<<"Press the Enter key when you are ready to see the answer";
cin.get();
//Display solution
cout<<"\nHere is the correct answer:\n\n";
cout<<setw(5)<<num1<<endl;
cout<<"+ "<<setw(3)<<num2<<endl;
cout<<"-----\n";
cout<<setw(5)<<sum<<endl;
return 0;
}