0

My goal is to write a problem that will read in a length in feet and inches and output the equivalent length in meters and centimeters. As noted, There are 0.3048 meters in a foot, 100 centimeters in a meter, and 12 inches in a foot. I am only having problems with the calculations. Hopefully someone can help me with it because I'm not good with math lol.

For example:

5 feet and 8 inches is equivalent to 1.7272 meters and 172.72 centimeters.

```
#include <iostream>
#include <stdio.h>
using namespace std;
const double meters_per_foot = 0.3048;
const int centimeters_per_meter = 100;
const int inches_per_foot = 12;
void getValues(double& feet, double& inches);
void calculate(double feet,double inches, double& meters, double& centimeters);
void print(double feet,double inches,double meters,double centimeters);
int main ()
{
double feet=0,inches=0;
double meters=0,centimeters=0;
char letter;
getValues(feet,inches);
calculate(feet,inches,meters,centimeters);
print(feet,inches,meters,centimeters);
system ("PAUSE");
return 0;
}
void getValues(double& feet, double& inches)
{
cout<<"Enter the number of feet: "<<endl;
cin>>feet;
cout<<"Enter the number inches: "<<endl;
cin>>inches;
}
void calculate(double feet,double inches, double& meters, double& centimeters)
{
centimeters = (inches_per_foot * 2.5400);
meters = (inches * meters_per_foot);
}
void print(double feet,double inches,double meters,double centimeters)
{
cout<<feet<<" feet and "<<inches<<" inches is equivalent to: "<<meters<<" meters and "<<centimeters<<" centimeters."<<endl;
}
```