Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
( 5 0 pts ) Write a program hw . cpp that reads in two lengths in the format x ' y ' ' (
pts Write a program hwcpp that reads in two lengths in the format ie feet inches and returns the difference in length between the two in the same format. You may assume that the first length is always larger than the second! Note that to represent the unit of inches, we use two singlequotation marks instead of one doublequotation mark. A typical run of your program should look like this user input shown in red: Enter two lengths in feet and inches larger first! Difference is Hint : First work on getting your program simply read the four measurement values, then work on getting it to print out the difference in inches, then work on getting the difference in feet and inches. Hint : The string constant works just fine, but to get the character constant of the apostrophe you must write which uses the backslash as an escape character. Hint : For ideas on how to chop a length in inches into feet and inches, look at the Minutes and Seconds program, which has to deal with the similar problem of chopping a time in seconds up into minutes and seconds.
pts Write a program hwcpp that reads in two lengths in the format ie feet inches and returns the difference in length between the two in the same format. You may assume that the first length is always larger than the second! Note that to represent the unit of inches, we use two singlequotation marks instead of one doublequotation mark.
A typical run of your program should look like this user input shown in red:
Enter two lengths in feet and inches larger first!
Difference is
Hint : First work on getting your program simply read the four measurement values, then work on getting it to print out the difference in inches, then work on getting the difference in feet and inches.
Hint : The string constant works just fine, but to get the character constant of the apostrophe you must write which uses the backslash as an escape character.
Hint : For ideas on how to chop a length in inches into feet and inches, look at the Minutes and Seconds program, which has to deal with the similar problem of chopping a time in seconds up into minutes and seconds.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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