Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions