Question: Using your text editor of choice, write a complete and working program that adds two numbers together with a function. Your program must adhere to
Using your text editor of choice, write a complete and working program that adds two numbers together with a function. Your program must adhere to the following requirements: 1. A function named add must be defined that adds two double type values together. It takes two parameters, one named lhs, and another named, rhs. The function returns a double type that is the value of lhs and rhs added together. 2. A main function that asks the user to enter in two numbers, calls your add function to add them together, and displays the answer to the terminal. After the main function completes its work, it returns an integer type. 3. The operation of your program should generate output similar to the given example output scenarios. 4. Your program must adhere to good style guidelines. Statements and curly braces should be properly indented and aligned. Example Output: Scenario #1 Enter a number: 3 Enter another number: 5 Total: 8 Scenario #2 Enter a number: 2.5 Enter another number: 1.5 Total: 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
