#include <iostream>
using namespace std;
/*Use void functions, they perform some action but do not return a value*/
//Function Protoype, input,read in feet and inches:
void input (double& feet, double& inches);
//Function Prototype, calculate, calculate with given formulae.
void calculate(double& feet, double& inches);
//Function Prototype, output, outputs calculations to screen.
void output (double meters, double centimeters);
int main ()
{
double feet;
double inches;
char repeat;
do
{
//Call input:
input(feet, inches);
//Call calculate:
calculate(feet, inches);
//Call output:
output (feet, inches);
cout << "\n";
cout << "Repeat? (Y/N): ";
cin >> repeat;
cout << "\n";
}
while (repeat == 'Y' || repeat == 'y');
}
//Input function definition:
void input (double& feet, double& inches)
{
cout << "Please enter the length in feet" << endl;
cin >> feet;
cout << "Please enter the length in inches" << endl;
cin >> inches;
}
//Calculate function definition, insert formulae here:
void calculate (double& feet, double& inches)
{
feet = (feet * 0.3048);
inches = (inches * 2.54);
}
//Output function definition:
void output (double meters, double centimeters)
{
cout << meters << " meters & " << centimeters << " cm's. " << endl;
}
Why is my conversion not working? Or what am I doing wrong?
Objective: Given a length in feet and inches I am suppose to output an equivalent length in meters and centimeters.
//Calculate function definition, insert formula here:
void calculate (double& feet, double& inches)
{
feet = (feet * 0.3048);
inches = (inches * 2.54);
}