Instruction: We will write a program that prompts the user to enter a length given in feet and inches, and and then converts it to equlvalent length in meters, and display the result. There are 0.3048 meters in a foot, and 12 inches in a foot. Please name your source code as lab6.cpp.
Your program works as follows:
An example run of your program is as follows, where the user inputs are underlined, and the program output are shown in regular format:
$ ./a.out Please enter the length in the format of (ft'inch''):5'10'' 5'10''= 177.80 cm Do you want to do another converstion (y/n):y Please enter the length in the format of (ft'inch''):5'6'' 5'6''= 167.64 cm Do you want to do another converstion (y/n):n Bye!Here is another run shows some wrong inputs and the error messages:
$ ./a.out Please enter the length in the format of (ft'inch''):6'14'' Wrong input! Inches should be between 0 and 11. Try again:-1'4'' Wrong input! Feet should be positive. Try again:2'4'' 2'4'' = 76.20 cm Do you want to do another converstion (y/n):n Bye!
Program Structure Requirement: In your program
#includeYou are required to design and implement the following functions:using namespace std; /* Declare all functions here */ ... int main() { } /* Define all your functions here */ ...
void ReadLengthFeetInches (int & feet, int & inches);
#include <iomanip> ... //displaying num1 in the format of 10.32 double num1=10.324; cout <<fixed <<showpoint; cout <<setprecision(2); cout <<num1;
How to submit
Please submit your program (which has to be named lab6.cpp) to the following webpage: