Question: 1. Write a short C++ program that performs the following tasks: // Declares variables // Prompts the user to enter two real numbers // Reads
1. Write a short C++ program that performs the following tasks: // Declares variables // Prompts the user to enter two real numbers // Reads the real numbers from the keyboard // if the second number is not zero / Formats the output to display the numbers in fixed format with one decimal digit // Prints their ratio on the screen along with the two values read from the file // otherwise // Prints on the screen, "Cannot divide by zero" Important: the ratio must be calculated by a value-returning function named ratiol). You must define the function ratio() below main( ). It receives two real numbers, divides the first number by the second one, and returns the result as real number. You do not need to round the result. Example: Please enter two real numbers: If the values input are 5.0 and 2.5, the output should be: Ratio 5.0/2.5 = 2.0 Note: include the prototype and the function definition in your solution. 2. Write a function that reads a whole number and a real number from the keyboard and returns them to the caller. The function must prompt the user to enter the two values. Call the function twice from main() and display the values entered in both occasions. Show the real numbers with 2 decimal digits IMPORTANT: the best way to know if you implemented these programs correctly is to compile your code and run it to see if it works as expected. Run my solutions to see what your programs must do
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
