Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab 07 Void functions Objective To practice using void functions. To begin using pass-by-reference parameters. Tasks In this week's lab, we have a few rules
Lab 07 Void functions Objective To practice using void functions. To begin using pass-by-reference parameters. Tasks In this week's lab, we have a few rules to follow: 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 andband 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. Don't alter the prototypes. Get your 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started