Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with my C++ homework. Thank you. Functions - Simple Math Tutor Instructions: Important: Please read carefully. All functions must be done exactly
I need help with my C++ homework. Thank you.
Functions - Simple Math Tutor Instructions: Important: Please read carefully. All functions must be done exactly as asked. Create a C++ console application to generate two small positive random integers between 1 and 9. Ask the user to add, subtract, and multiply the two numbers. As long as the answer is incorrect, keep asking the user for a correct answer. Requirements: Create six functions with following prototypes: void getRandNum(int&); (One reference parameter only) Called by main twice to provide two small random integers (1 to 9) bool isAnswerRight(int, int, int, char); (Char is used to pass the operator) Pass the random numbers, the answer, and the operator (+,-;*) This function is called by the following functions. The following functions receive the random numbers as arguments and ask the questions from the user. They call the isAnswerRight() to check the answer. void add(int, int); (Called by the main function) void multiply(int, int); (Called by the main function) void subtract(int, int); (Called by the main function) How to do it: First, create getRandNum(). Test it to see if it is returning a random number. Code the add() function, and test it without error checking, first. Add the isAnswerRight() function, and call it by add() for error checking. subtract() and multiply() work the same as the add() function with different operators. Additional Requirement: After all questions are answered, ask the user if they want to continue. If the answer is yes, create two new random numbers. This must be done in a loop that will repeat the process again and againStep 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