Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 : 5

Please enter your second integer and press : 9

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 : 7

Please enter your second integer and press : 2

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 : 3

Please enter your second integer and press : 5

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

From Herds To Insights Harnessing Data Analytics For Sustainable Livestock Farming

Authors: Prof Suresh Neethirajan

1st Edition

B0CFD6K6KK, 979-8857075487

More Books

Students also viewed these Databases questions