Explore BrainMass

C++ console program to convert feet + inches to centimeters

Write a C++ program that prompts the user to enter a length in feet and inches and outputs the equivalent length in centimeters. If the user enters a negative number or a non-digit number, throw and handle an appropriate exception and prompt the user to enter another set of numbers.

Solution Preview

Please find attached C++ code (file Main.cpp). The program logic is simple to follow. After the ...

Solution Summary

After the welcome message user is prompted to enter length in feet. If we are not able to validate entry an exception is thrown. Exception message is displayed to the user and he is prompted to enter data again. Same thing happens with entry of inches. Then we convert feet and inches to centimeters. The result is displayed.