// Nicolas Ruano CS1A Chapter 3, Pp. 143, #15
/*******************************************************************************
* CALCULATING A BASIC MATHEMATICAL PROBLEM
* ____________________________________________________________________________
* This program demeostrates of how you can write a basic mathematical problem
* in C++, with teh following steps to solve
* ____________________________________________________________________________
* Given values to solve
* 247
* 129
* Add all the values to get the final result for the program to execute
******************************************************************************/
#include <iostream>
#include <cstdlib> // For rand() and srand()
#include <ctime> // For time()
using namespace std;
int main() {
// Seed random number generator
srand(time(0));
// Generate two random numbers between 100 and 999
int num1 = rand() % 900 + 100;
int num2 = rand() % 900 + 100;
// Display the problem
cout << "Solve this problem:" << endl;
cout << " " << num1 << endl;
cout << "+ " << num2 << endl;
cout << "-----" << endl;
// Pause for student input (even if not used)
int answer;
cout << "Your answer: ";
cin >> answer;
// Show the correct answer
cout << "Correct answer: " << (num1 + num2) << endl;
return 0;
}