1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#include <iostream>
using namespace std;
void get_input(double& feet, double& inches, double& meters, double& centimeters);
double convert(double& feet, double& inches, double& meters , double& centimeters);
void give_output(double feet, double inches, double meters, double centimeters);
int main()
{
double feet, inches, meters, centimeters;
char check;
do {
get_input(feet, inches, meters, centimeters);
convert(feet, inches, meters, centimeters);
give_output(feet, inches, meters, centimeters);
cout<<"Repeat calculation? (Y/N)"<<endl;
cin>>check;
}while(check == 'Y' || check == 'y');
system("pause");
return 0;
}
void get_input(double& feet, double& inches, double& meters, double& centimeters)
{
cout<<"Enter feet to convert it to meters: ";
cin>>feet;
cout<<endl<<"Enter inches to convert it to centimeters: ";
cin>>inches;
}
double convert(double& feet, double& inches, double& meters , double& centimeters)
{
meters = feet * 0.3048;
return meters;
centimeters = inches * 2.54;
return centimeters;
}
void give_output(double feet, double inches, double meters, double centimeters)
{
cout<<feet<<" feet " <<inches<<" inches is equivalent to "<<meters<<" meters "<<centimeters<<" centimeters"<<endl;
}
|