Code:
- #include <iostream>
- using namespace std;
- void get_input ( double &inches, double &feet );
- void give_output( double centimeters, double meters );
- int main ()
- {
- double inches, feet, meters, centimeters;
- char response = '1' || '2' ;
- char answer = 'y';
- cout << "We are going to convert inches and feet into meters." << endl;
- cout << "Please input the measurement output you would like." << endl;
- cout << "(1 for meter and centimeter output, 2 for inches and feet output): ";
- cin >> response;
- cout << endl;
- if ( response == '1' ) {
- get_input ( inches, feet );
- feet = inches * 12;
- meters = feet * 0.3048;
- centimeters = meters * 100;
- give_output ( centimeters, meters );
- cout << " Would you like to re-use this program ( Y - yes, N - no ): ";
- cin >> answer;
- }
- else if ( response == '2' ) {
- void get_input ( double meters, double centimeters );
- {
- cout << "Please input the meters measurement: ";
- cin >> meters;
- cout << endl;
- cout << "Please input the centimeters measurement: ";
- cin >> centimeters;
- cout << endl;
- }
- inches = feet * 12;
- feet = meters * 39.37;
- meters = centimeters / 100;
- void give_output( double inches, double feet );
- {
- cout << " There are ";
- cout << feet;
- cout << " feet from the given measurements." << endl;
- cout << " There are ";
- cout << inches;
- cout << " inches from the given measurements." << endl;
- }
- cout << " Would you like to re-use this program ( Y - yes, N - no ): ";
- cin >> answer;
- }
- }
- void get_input ( double &inches, double &feet )
- {
- cout << "Please input the feet measurement: ";
- cin >> feet;
- cout << endl;
- cout << "Please input the inches measurement: ";
- cin >> inches;
- cout << endl;
- }
- void give_output( double centimeters, double meters )
- {
- cout << " There are ";
- cout << meters;
- cout << " meters from the given measurements." << endl;
- cout << " There are ";
- cout << centimeters;
- cout << " centimeters from the given measurements." << endl;
- }
Is this on the right track?