471,881 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,881 software developers and data experts.

Converting English to Metric and vice versa via pass-by-reference void function.

Im stuck at this point. The way i was trying to do this was running if statement around my void function and then a else if statement around a different void function but it didnt work... right now i deleted part of what i had but left my skeleton of it there...

Expand|Select|Wrap|Line Numbers
  1.  #include <iostream>
  2. using namespace std;
  3. void get_numbers(double& input1, double& input2);
  4. void show_results(double output1, double output2);
  5.  
  6. int main()
  7. {
  8.   char letter;
  9.  
  10.   cout<<"Metric to English and English to Metric converter.\n"
  11.       <<"For Metric to English type m, for Enlish to Metric type E, Type q to quit.\n";
  12.   cin>>letter;
  13.  
  14.      double first_num, second_num;
  15.  
  16.      get_numbers(first_num, second_num);
  17.      show_results(first_num, second_num);
  18.      return 0;
  19. }
  20.  
  21.  
  22. void get_numbers(double& input1, double& input2)
  23.  {
  24.   using namespace std;
  25.   cout<< "Enter first number as meters and second as centimeters.\n";
  26.   cin>> input1
  27.      >> input2;
  28.   input1 = input1 * 3.2808399;
  29.   input2 = input2 * .393700787;
  30.  }
  31.  
  32.  void show_results(double output1, double output2)
  33.  {
  34.   using namespace std;
  35.   cout<< "Feet: "<<output1<<" Inches: "<<output2<<endl;
  36.  }
  37.  
Oct 12 '07 #1
3 3740
weaknessforcats
9,208 Expert Mod 8TB
The way i was trying to do this was running if statement around my void function and then a else if statement around a different void function but it didnt work...
I can't see what your difficulty is when you have deleted the code that caused it.
Oct 12 '07 #2
pbmods
5,821 Expert 4TB
Heya, socondc22.

What do you want your code to do? Give an example.
What is your code doing that you don't want it to do? Give an example.
What is your code *not* doing that it is supposed to? Give an example.
Oct 14 '07 #3
JosAH
11,448 Expert 8TB
@OP: please don't start two or more threads on this very same topic.

kind regards,

Jos
Oct 14 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Dan Stromberg | last post: by
7 posts views Thread by Anonymous | last post: by
7 posts views Thread by Jus! | last post: by
reply views Thread by Aziz Paracha | last post: by
1 post views Thread by Maric Michaud | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.