Question: please use C++ In this question, we will calculate the total distance a snail travels over a sequence of days Write a program that asks
please use C++
In this question, we will calculate the total distance a snail travels over a sequence of days Write a program that asks the user to enter the number of inches a snail traveled in each day. The numbers should be entered in separate lines, and end with - 1 (to indicate the end of the sequence). After reading the numbers, your program should print the total distance the snail traveled. This distance should be printed in a (miles, yards, inches) format Note: You may use the following facts: I foot = 12 inches I yard = 3 feet Your program should interact with the user exactly as demonstrated bellow. Execution example: Enter the number of inches the snail traveled in day #1, or type -1 if they reached their destination: 132 Enter the number of inches the snail traveled in day #2, or type -1 if they reached their destination: 440 Enter the number of inches the snail traveled in day #3, or type -1 if they reached their destination: 265 Enter the number of inches the snail traveled in day #4, or type -1 if they reached their destination: 7 Enter the number of inches the snail traveled in day #5, or type -1 if they reached their destination: -1 In 4 days, the snail traveled 23 yards, 1 feet and 4 inches
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
