473,418 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 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 3863
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

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

Similar topics

0
by: Dan Stromberg | last post by:
I've written up a page about how to convert native binary data to another platform's native binary data, as I did some fortran data conversions for a client. The programs and documentation are...
1
by: Dharmendra Singh | last post by:
Hi I'm using .Net(C#) and working on the form(Screen) which have text boxes for both arabic and english data to store. So i want to change the language at run time from arabic to english and...
7
by: Anonymous | last post by:
I have a mixed-language pgm (Fortran and C++) which needs to pass a few hundred values from C++ to Fortran. One way to do this is to have a Fortran module and a C++ structure (or class) with an...
7
by: Jus! | last post by:
Hi. I am reading bits(1's & 0's) from a file and i wa wondering what is the most efficient method of converting these strings to individual int's? eg. File contains: 110001 010011 etc......
29
by: Armand Karlsen | last post by:
I have a website ( http://www.zen62775.zen.co.uk ) that I made HTML 4.01 Transitional and CSS compliant, and I'm thinking of converting it into XHTML to learn a little about it. Which XHTML variant...
0
by: Aziz Paracha | last post by:
Hi: I am very new to .NET web services. I have a situation here; I want a web service that will communicate with plain ASP page. It will call ASP page with some query string variables, the ASP...
5
by: bob | last post by:
Hi Using 2003 - targeting the compact framework (c#), but would like to do most development using the full.net (manually leaving out stuff not in the compact framework). Q. Trying to find a...
1
by: suresh_nsnguys | last post by:
Hi, I am having 2 text boxes with label 'English' and 'chinese'.If i enter some English text in 'English' text box and press submit button.I need to display the chinese text for that English...
1
by: Maric Michaud | last post by:
Le Tuesday 24 June 2008 07:08:46 swapna mudavath, vous avez écrit : This is not valid xml, there is no commas in attribute list in xml. You could try with minidom if your xml stream isn't too...
7
by: victory2006 | last post by:
like we have an integer value of : 9 and i need to convert it to binary numbers and vice versa, thanks!
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.