473,804 Members | 3,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

67 New Member
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 3895
weaknessforcats
9,208 Recognized Expert Moderator Expert
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 Recognized Expert Expert
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 Recognized Expert MVP
@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
1915
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 at: http://dcs.nac.uci.edu/~strombrg/converting-binary.html So far, the page includes a variety of programs written in C or python to do:
1
3350
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 vice-versa, when the control moves from one text box to another. Regards Dharmendra
7
5217
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 identical data layout. I have used this idea with no problem, but it necessitates making changes very carefully to the Fortran module and the C++ structure to keep them "in sync". I am looking for a program which translates source files between...
7
2415
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... Whats the best way to read in each line and break it up into individual ints?
29
3911
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 would you recommend? The w3c HTML validator mentions XHTML 1.0 Transitional, Basic, Strict, and XHTML 1.1. Would I be able to make my existing CSS work in the XHTML page without modification to the .css file?
0
946
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 page will do some tasks and then it will callback the web service and pass it the result of operation. My questions is, It is possible to call ASP page from Web service and vice versa? If yes, do you have some helpful pointers/code sample?
5
3358
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 way of converting a project to have builds for both compact and full. Project properties doesn't seem to help Thanks
1
5277
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 text in the chinese text box.and also for Vice versa I don't know how to convert from English text to chinese text .Whether its possible to convert using PHP. I saw some sample websites.They implemented this same functionality using...
1
2010
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 large, else sax parser is to be considered, but minidom is pretty easy to use. Give it a try and come back with more specific questions.
7
6782
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
9569
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9130
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5503
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2975
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.