programming

Write a program that will read in a length in feet and inches and will output the equivalent length in meters and centimeters. Use at least three functions : one for input, one or more for calculating and one for output. There are 0.3048 meters in a foot, 100 centimeters in a meter and 12 inches in a foot

Answers

#include //Function prototypes void inputInFtIn(float &feet,float &inches); //Function that collects input void convertTomsm(float &feet,float &inches,float &meters,float ¢imeters); //Function that //converts input to meters //and centimeters void displayResults(float meters, float centimeters); //Function that displays results int main() { float feet,inches; float meters = 0.0; float centimeters = 0.0; //Call function for collecting input inputInFtIn(feet, inches); //Call function for converting to meters and centimeters convertTomsm(feet, inches, meters, centimeters); //Call function for displaying the results displayResults(meters, centimeters); return 0; } //Function to collect input void inputInFtIn(float &feet,float &inches) { std::cout << "Enter length in feet and inches : "; std::cin >> feet >> inches; } //Function to convert to meters and centimeters void convertTomsm(float &feet,float &inches,float &meters,float ¢imeters)

Answered by John

We have mentors from

Contact support