## Question

We have been tasked to implement a program/application that makes learning algebra fun! This program will ask the student if they want to solve an addition, multiplication, subtraction, division, or random one-variable equation. The student is in an elevator and trying to get all the way to the top floor of a building for the gold prize by solving each equation correctly and moving up or down floors based on their answer! You will ask the student how many floors there are in the building to start, and when the student solves the equation correctly, they get to go up one floor closer to the gold. If the user solves the equation incorrectly, then they go down one floor. After the student solves the equation, you must re-prompt the student for which type of equation they want solve again (addition, multiplication, subtraction, division, or random), until they reach the gold on the top floor of the building. The numbers in the equations are between 0-100 (inclusive), and you will generate one number for the expression and one number for the solution/right side of the equation. After the student reaches the gold, you must ask the student if they want to play again.

You must always inform the user which level of the building they are on with a message and ASCII art!!! You must insert a blank line between re prompting the student with a new equation to solve. If the student wins and wants to play again, you must ask how many floors are in the new building.

For example:

How many floors are in your building? 3

| |

----------

| |

----------

| X |

----------

Do you want to solve a multiplication (1), addition (2), subtraction (3), division (4), or

random (5) equation? 1

Solve x * 10 = 100, what is x? 10

Good job, you are on level 2!

| |

----------

| X |

----------

| |

----------

Do you want to solve a multiplication (1), addition (2), subtraction (3), division (4), or

random (5) equation? 2

Solve x + 50 = 4, what is x? -46

Good job, you are on level 3!

| X |

----------

| |

----------

| |

----------

You win the game!!!

Do you want to play again (0-yes, 1-no)? 1

Requirements:

* Catch all bad input (bad cases, non-matching types, etc.)!!!

* Have at least 3 functions!

* Display a message and asking ASCII art showing where the student is in theelevator.

* Ask the user if they want to re-play the game after winning.

Creative Contest!!! Who has the most entertaining program with ASCII art? You have to let us know if you want to enter the contest, and the students will vote on who has the best user interface.

Extra

All your functions, including main, must not be more than 15 lines in length!!!

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

#include <iostream>#include <string>

#include <cstdlib>

using namespace std;

/**

* generate value of result and operand bases on the operator

* @param operators

* @param operand

* @param result

* @return x

*/

int generate(int & operators, int & operand, int & result) {

int x;

// random case

if (operators == 5) {

operators = (rand() % 4) + 1;

}

/**

* After the student solves the equation, you must re-prompt the student

* for which type of equation they want solve again

* (addition, multiplication, subtraction, division, or random),

* until they reach the gold on the top floor of the building.

* The numbers in the equations are between 0-100 (inclusive),

* and you will generate one number for the expression and

* one number for the solution/right side of the equation.

*/

switch (operators) {

case 1:

x = rand() % 10;

operand = rand() % 10;

result = x * operand;

break;

case 2:

operand = rand() % 101;

result = rand() % 101;

x = result - operand;

break;

case 3:

operand = rand() % 101;

result = rand() % 101;

x = result + operand;

break;

case 4:

operand = rand() % 101;

result = rand() % 101;

x = operand * result;

}

return x;

}...

By purchasing this solution you'll be able to access the following files:

Solution.cpp.