Question: Write a C++ program that does the following: Prompt user to enter 2 integers, representing a length in feet and inches. Convert the two input
Write a C++ program that does the following:
Prompt user to enter 2 integers, representing a length in feet and inches.
Convert the two input numbers to all inches and store the result in a variable named length1.
(If the user entered 2 and 6, this would mean 2 feet and 6 inches, so length1 should be set to 30.
Prompt user to enter another 2 integers, representing a length in feet and inches.
Convert the two input numbers to all inches and store the result in a variable named length2.
(If the user entered 3 and 8, this would mean 3 feet and 8 inches, so length1 should be set to 44.
Add the two lengths and output the result as feet and inches. In the example above, the sum is 74, so the program should print
6 feet 2 inches
Note: you can use integer division / and remainder % to convert a length in all inches to feet and inches.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
