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