# Thread: Void conversion function for feet and inches to meters and centimeters?

1. ## Void conversion function for feet and inches to meters and centimeters?

I got all the rest of the code working but I just can't figure out how to convert the input into meters and centimeters. For example I know that 1 foot is 0.3048 meters, so I need to multiply the feet by 0.3048.

But every time I run it, it never converts it, it just says 6.78222e-308 meters.

Here's the code:

Code:
```#include <iostream>
using namespace std;

void userInput(double& feet, double& inches);
void convertUStoMetric(double& meters, double& centimeters);
void output(double meters, double centimeters);

int main()
{
double unit, subunit;
char redo = 'y';

while (redo == 'y' || redo == 'Y')
{

userInput(unit, subunit);
convertUStoMetric(unit, subunit);
output(unit, subunit);

cout << "Would you like to run it again? Y/N: ";
cin >> redo;
cout << "\n";
}

system("pause");
return 0;
}

void userInput(double& feet, double& inches)
{
cout << "Enter the feet and inches with a space in between each: ";
cin >> feet;
cin >> inches;
cout << "\n";
}

void convertUStoMetric(double& meters, double& centimeters)
{
double total;
total = total * 0.3048;
meters = total;

}

void output(double meters, double centimeters)
{
cout << "The converted measurements are " << meters << " meters and " << centimeters << " centimeters.";
cout << "\n\n";
}```
I don't understand how I'm supposed to do the convertUStoMetric conversion function.

Am I supposed to create a new variable?

2. OK never mind about the conversion, I got

Code:
`meters = meters * 0.3048;`
and it worked for the feet to meters conversion.

But I have to make it so there are no decimals in it. If it's 10 feet to meters, it'll have to be 3 meters and ? centimeters.

3. Wow thanks that actually works great and does exactly what I want it to!