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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
//Program name: Convert to Meters Centimeters
//Program Description: This program will convert feet and inches into meters and centimeters from user input
//Programer Name: Joey Pham
//Date: 07/13/2019
#include <iostream>
#include <iomanip>
using namespace std;
//function prototype
void getFeetInches(int &feet, int &inches);
void covertToMeterCentimeter(int feet, int inches, int &meters, int ¢imeters);
//void displayResults(int feet, int inches, int meters, int centimeters);
int main()
{
int feetValue,
inchesValue,
metersValue,
centimetersValue;
char again;
getFeetInches(feetValue, inchesValue);
covertToMeterCentimeter(feetValue, inchesValue, metersValue, centimetersValue);
// displayResults(int feet, int inches, int meters, int centimeters);
};
/************************************************************************************
* getFeetInches *
* Gets input from user for the amount of feet and inches that needed to be *
* converted.
************************************************************************************/
void getFeetInches(int &feet, int &inches)
{
cout << "Enter feet: ";
cin >> feet;
cout << "Enter inches: ";
cin >> inches;
};
void covertToMeterCentimeter(int feet, int inches, int &meters, int ¢imeters)
{
double metTemp, centTemp;
metTemp = (feet+(inches/12.0))*0.3048;
meters = metTemp;
centTemp = (metTemp*100) - 100;
centimeters = centTemp;
cout << meters << " meter(s) and " << centimeters << " centimeter" << endl;
};
/*
void displayResults(int feet, int inches, int meters, int centimeters)
{
};
*/
|