rerun program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • socondc22
    New Member
    • Sep 2007
    • 67

    #1

    rerun program

    just wondering how to rerun my program after printing out the answer...
  • oler1s
    Recognized Expert Contributor
    • Aug 2007
    • 671

    #2
    Originally posted by socondc22
    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.

    Comment

    • socondc22
      New Member
      • Sep 2007
      • 67

      #3
      Originally posted by oler1s
      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..

      [CODE=c]
      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(fir st_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(fi rst_num, second_num);

      }while(letter == 'm' || letter == 'M' | letter == 'e' || letter == 'E');

      }
      [/CODE]
      Last edited by pbmods; Oct 14 '07, 07:33 PM. Reason: Fixed CODE tags.

      Comment

      • Laharl
        Recognized Expert Contributor
        • Sep 2007
        • 849

        #4
        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.

        Comment

        Working...