By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,400 Members | 1,197 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,400 IT Pros & Developers. It's quick & easy.

rerun program

P: 67
just wondering how to rerun my program after printing out the answer...
Oct 12 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 671
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

P: 67
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

Expert 100+
P: 849
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

Post your reply

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