473,799 Members | 3,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

rerun program

67 New Member
just wondering how to rerun my program after printing out the answer...
Oct 12 '07 #1
3 5048
oler1s
671 Recognized Expert Contributor
just wondering how to rerun my program after printing out the answer...
You need a loop. Read C++ tutorials on loops. You need to enclose whatever portion you want to rerun in a giant loop.
Oct 12 '07 #2
socondc22
67 New Member
You need a loop. Read C++ tutorials on loops. You need to enclose whatever portion you want to rerun in a giant loop.

i can rerun it now... but now everytime it does not print out my answers..

Expand|Select|Wrap|Line Numbers
  1.  
  2.  do
  3.   {
  4.  
  5.   cout<<"Metric to English and English to Metric converter.\n"
  6.       <<"For Metric to English type m, for Enlish to Metric type E, Type q to quit.\n";
  7.   cin>>letter;
  8.  
  9.   get_numbers(first_num, second_num);
  10.  
  11.   if(letter == 'm' || letter == 'M')
  12.     {
  13.       first_num = first_num * 3.2808399;
  14.       second_num = second_num * .393700787;
  15.     }
  16.   else if(letter == 'e' || letter == 'E')
  17.     {
  18.       first_num = first_num * .3048;
  19.       second_num = second_num * 2.54;
  20.     }
  21.  
  22.   else if(letter == 'q' || letter == 'Q')
  23.  
  24.   show_results(first_num, second_num);
  25.  
  26.   }while(letter == 'm' || letter == 'M' | letter == 'e' || letter == 'E');
  27.  
  28. }
  29.  
Oct 12 '07 #3
Laharl
849 Recognized Expert Contributor
You're only calling show_results when the user enters q or Q, which presumably is the quit command. Therefore, the only values printed are the last modified.
Oct 12 '07 #4

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

Similar topics

22
3612
by: edgrsprj | last post by:
PROPOSED EARTHQUAKE FORECASTING COMPUTER PROGRAM DEVELOPMENT EFFORT Posted July 11, 2005 My main earthquake forecasting Web page is: http://www.freewebz.com/eq-forecasting/Data.html Newsgroup Readers: If you circulate copies of this report to groups of computer programmers at different universities etc. around the world then they might find the subject matter to be interesting.
0
6144
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug file as folows. I need help to resolve them ASAP: cl /c /nologo /MDd /W3 /Od /GR /GM /Zi /GX /D "_DEBUG" /D " WIN32" /D "_W INDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /
11
2615
by: christopher diggins | last post by:
I am wondering if any can point me to any open-source library with program objects for C++ like there is in Java? I would like to be able to write things like MyProgram1 >> MyProgram2 >> Fork(MyProgram3, SomeFile); If not would this be something of interest to others? Thanks in advance,
5
1636
by: Stuart Dee | last post by:
Hi, I have created a com+ component with vb dot net using jit activation and transactions If i call it like this x=createobject("mycomp") x.dispose
5
2700
by: portroe | last post by:
Hi, how can I get my forms program to perform a particular action again if the incorrect format is entered, I have tried GOTO line xxx
1
1637
by: Feng | last post by:
Hi, I am currently experiencing a wired issue. Every time I start my my dev server machine to run my ASP.Net app, the IIS server is not functioning - I get page can not be displayed error and I have to rerun the aspnet_regiis -i to make it work. I also found that, when this happens, all the .html pages are served fine, but all the .aspx pages, AND all .asp pages, are not served. What is going on here?
4
21353
by: Bill Nicholson - Cincinnati, OH | last post by:
This Access app is in Access 2000 format. It is a mature app that is running on machines all over the LAN. Today when I tried to put it on a new PC with a fresh copy of Win XP and Access 2003. XP has all patches installed and is SP 2. I got this error: Can't be started. Was unable to initialize the Windows Registry. Rerun Microsoft Access or Microsoft Office Setup to reinstall I ran the app as domain admin and local admin, no change.
63
5405
by: socondc22 | last post by:
So i have a question on how i should start doing this... pretty new at c++ i have to ask the user for an integer, an operator, and then another integer to give an answer. But i also have to show the whole equation. I want to try to use loops to do this.
3
1838
by: Saxx | last post by:
i have created a program that counts change for school but i am also wanting to add the ability fot the program to rerun on request and display an error message for negatitve numers, 0 or letters. can anyone help? thanks #include <iostream> using std::cout; using std::cin; using std::endl;
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10485
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10231
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
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...
1
7565
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
6805
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
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
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.