Question
Help on C++ Create four functions for addition, subtraction, multiplication, and division that each accept two double values as operands and return the result. Each
Help on C++
Create four functions for addition, subtraction, multiplication, and division that each accept two double values as operands and return the result. Each function will perform its operation using the operands. Example: Operation is addition, first operand is 3.5, second operand is 7.2, the addition function should return 10.7. Create a fifth function Display_Result that takes 4 parameters, two doubles for the operands, a char for the operator, and a double for the result, and display the equation with result nicely. Note: This function should have a return type of void and does not do any math or care about what the result is or its accuracy (the math functions handle that) it just prints the equation. For example, if passed 2, 3.1, *, 6.2 then it would print 2 * 3.1 = 6.2. In main ask the user to enter the two operands (decimal values). Have the user select an operation to perform on the array by typing +, - , * or /. Call the selected function for the given operator passing it the user-selected values, and then pass the result along with the operator and operands to the print function to print the results.
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