Unit Conversion from feet to meters
- by user1742419
I have to write a program that reads in a length in feet and inches and outputs the equivalent length in meters and centimeters. I have to create three functions: one for input, one or more for calculating, and one for output; And include a loop that lets the user repeat this computation for new input values until the user says he or she wants to end the program. I can't seem to get the input from one function to be used in the conversion function and then outputted by the next function. How do I do that? Thank you.
#include <iostream>
#include <conio.h>
using namespace std;
double leng;
void length(double leng);
double conv(double leng);
void output(double leng);
int main()
{
length(leng);
conv(leng);
output(leng);
_getche();
return 0;
}
void length(double leng)
{
cout<<"Enter a length in feet, then enter a length in inches if needed: ";
cin>>leng;
return;
}
double conv(double leng)
{
return leng = leng * .3048;
}
void output(double leng)
{
cout<<"Your input is converted to "<<leng;
return;
}