Question
Write a C++ program to: a. Prompt the user for two positive integers, divide the larger by the smaller, and print the answer as a
Write a C++ program to:
a. Prompt the user for two positive integers, divide the larger by the smaller, and print the answer as a quotient and remainder.
b. Use main( ) as the driver function. Allow the user to run the program as many times as desired.
c. Write 5 functions that main( ) calls to accomplish the task:
1. getIntegers( ): Prompts the user for two positive integers. Use reference parameters.
2. findLargeAndSmall( ): Determines which of the integers is larger and which is smaller. Returns the larger and smaller integers via reference parameters.
3. calcQuotient( ): Calculates and returns the quotient of the larger integer divided by the smaller.
4. calcRemainder( ): Calculates and returns the remainder of the larger integer divided by the smaller.
5. displayResults( ): Prints the quotient and the remainder in the form typically used for long division problems in grade school. e.g. The answer for 7/2 is displayed as 3 R1.
Sample I/O:
**************************************************************
This program will ask you to enter two positive integers.
It will divide the larger by the smaller and display the
result as a quotient and remainder.
**************************************************************
Please enter your first integer and press
Please enter your second integer and press
The answer for 9/5 is 1 R 4
Would you like to process another set of numbers (Y or N)? y
**************************************************************
This program will ask you to enter two positive integers.
It will divide the larger by the smaller and display the
result as a quotient and remainder.
**************************************************************
Please enter your first integer and press
Please enter your second integer and press
The answer for 7/2 is 3 R 1
Would you like to process another set of numbers (Y or N)? y
**************************************************************
This program will ask you to enter two positive integers.
It will divide the larger by the smaller and display the
result as a quotient and remainder.
**************************************************************
Please enter your first integer and press
Please enter your second integer and press
The answer for 5/3 is 1 R 2
Would you like to process another set of numbers (Y or N)? n
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