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
+ 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
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    do   {     cout<<"Metric to English and English to Metric converter.\n"       <<"For Metric to English type m, for Enlish to Metric type E, Type q to quit.\n";   cin>>letter;     get_numbers(first_num, second_num);     if(letter == 'm' || letter == 'M')     {       first_num = first_num * 3.2808399;       second_num = second_num * .393700787;     }   else if(letter == 'e' || letter == 'E')     {       first_num = first_num * .3048;       second_num = second_num * 2.54;     }     else if(letter == 'q' || letter == 'Q')     show_results(first_num, second_num);     }while(letter == 'm' || letter == 'M' | letter == 'e' || letter == 'E');   }   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.