Conversion of feet/inches to meters-feet, replace the miles with meters, and allow repeated calculation:
// Conversion of feet/inches to meters-feet, replace the mile value with meters, and allow repeated calculation # include <iostream> # include <cmath> using namespace STD; void get_input (double & feet, double & inch); double convert (double & feet, double & inch, double & Meter); void output (double meter); int main () {double feet, inch, meter; char ans; do {get_input (feet, inch); convert (feet, inch, meter); output (meter ); cout <"do you want again? "; CIN> ans;} while ('y' = ans | 'y' = ans); Return 0;} void get_input (double & feet, double & inch) {cout <"Enter the feet and the inch: \ n"; CIN> feet> inch;} double convert (double & feet, double & inch, double & Meter) {double TEM; TEM = feet + inch/12; meter = TEM * 0.3048;} void output (double meter) {cout. SETF (IOs: fixed); cout. SETF (IOs: showpoint); cout. precision (2); cout <"The result is" <meter <"M" <Endl ;}
Result:
Enter the feet and the inch: 5 7The result is 1.70mdo you want again? Yenter the feet and the inch: 245 0the result is 74.68mdo you want again?
Conversion of feet/inches to meters-feet, replace with meters for miles