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 input(double &feet, double &inches);
void conversion (double feet, double &inches, int &meters, double ¢imeters);
void output(int meters, double centimeters);
int main ()
{
int meters;
double feet, inches, centimeters;
char menu;
do
{
cout << "Do You Want To Continue?(Y/N): ";
cin >> menu;
input(feet, inches);
conversion(feet, inches, meters, centimeters);
output (meters, centimeters);
}while (menu == 'Y' || menu == 'y');
}
void input(double &feet, double &inches)
{
cout << "Enter number of feet: ";
cin >> feet;
cout << "Enter number of inches: ";
cin >> inches;
}
void conversion (double feet, double &inches, int &meters, double ¢imeters)
{
inches += 12 * feet;
centimeters = inches * 2.54;
meters = centimeters/100;
centimeters -= meters*100;
}
void output (int meters, double centimeters)
{
cout << meters << " meters and " << centimeters << "cm " << endl;
}
return 0:
}
|