due at midnight on +60
This will be another unit conversion program, but much fancier because now we know a bit about strings and conditionals.
Your program will first ask the user for a unit of measurement. Then it asks for the quantity in that unit. Finally, it asks the user for the target unit. Here is an example. The user types anything that follows a colon (:
):
Enter a unit of measurement: yards
Enter a quantity: 4.2
Enter target unit: inches
4.2 yards is 151.2 inches
Your program should support distance conversions between yards, meters, centimeters, inches, kilometers, and miles.
If the user types an unknown unit, then you should give a friendly error message.
Enter a unit of measurement: furlongs
ERROR: I don't know about furlongs.
Once it works with the above units, if you want to get really fancy, you can try also adding unit conversions that aren’t distance: fahrenheit, celsius, pounds, kilograms, ounces, milliliters, pints, etc.
Call your program p4convert.cpp
and submit on Blackboard.