Question: C++ help! A few rules to follow to implement this program: - All functions must be void functions. - No cin or cout statements in

C++ help!

A few rules to follow to implement this program:

- All functions must be void functions.

- No cin or cout statements in int main.

-No global variables. As a consequence, all your functions that need to return a value will have to handle that via pass-by-reference parameters. Implement the following functions:

- void menu(int& usrChoice); Outputs the main menu and then stores the value the user inputted in usrChoice.

- void getNums(int& a, int& b); Asks the user to enter values for a and b and stores the responses in the corresponding variables.

- void add(int a, int b); Adds the values of a and b and outputs the result.

- void sub(int a, int b); Subtracts b from a and outputs the result.

- void mul(int a, int b); Multiplies a by b and outputs the result.

- void div(int a, int b); Divides a by b and outputs the result.

Dont alter the prototypes. I need this program to match the following output and also to be able

to handle different values of a and b according to the menu actions the user chooses.

Sample Output (user input is italicized)

==Main Menu==

1 - add 'a' to 'b'

2 - subtract 'b' from 'a'

3 - multiply 'a' by 'b'

4 - divide 'a' by 'b'

5 - exit

> 1

Enter number a: 4

Enter number b: 5

a + b = 9

==Main Menu==

1 - add 'a' to 'b'

2 - subtract 'b' from 'a'

3 - multiply 'a' by 'b'

4 - divide 'a' by 'b'

5 - exit

> 2

Enter number a: 10

Enter number b: 3

a - b = 7

==Main Menu==

1 - add 'a' to 'b'

2 - subtract 'b' from 'a'

3 - multiply 'a' by 'b'

4 - divide 'a' by 'b'

5 - exit

> 3

Enter number a: 4

Enter number b: 5

a * b = 20

==Main Menu==

1 - add 'a' to 'b'

2 - subtract 'b' from 'a'

3 - multiply 'a' by 'b'

4 - divide 'a' by 'b'

5 - exit

> 4

Enter number a: 101

Enter number b: 20

a / b = 5.05

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!