//Andres Guzman CSC5 Chapter 3, P. 146, #15
//
/**************************************************************
*
* DISPLAY TWO NUMBERS AND REQUIRE INPUT PRIOR TO ANSWER
* ____________________________________________________________
* This program will generate two random numbers and require input to receive answer
* Computation is based on the formula:
* sum = y + x
____________________________________________________________
* INPUT
* y : generates a random number between 1 and 999
* x : generates a random number between 1 and 999
* OUTPUT
* sum : added total of x and y
**************************************************************/
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
unsigned seed = time(0);
srand(seed);
//
//Initializing variables
int y = 1 + rand() % 999; //Input for randomly generated number on top
int x = 1 + rand() % 999; //Input for randomly generated number on bottom
//
//Output results
cout << right << setw(5) << y << endl;
cout << "+ " << x << endl;
cin.get(); //requires enter to be pressed before answer is displayed
//
//Computing formula
int sum = y + x; //Output to add both numbers together
//
//Output results
cout << right << setw(6) << "----\n" << right << setw(5) <<sum << endl;
}