title: C++ time conversion program
body: <p>This is an assignment for a class and I have it almost to where I want it just wanting some advice on the best way to proceed. </p>
  
  <p>The user will enter time in a 24 hour format and a delay time in hours and minutes. I must compute and display the time in AM/PM format at the end of the delay. I have to use functions and must not use global variables. I also need to have a condition to quit when 999 is entered for the hours section.</p>
  
  <p>Basically, I am trying to decide the best way to proceed with computing the delay. I've tried a few different methods but, haven't really been happy with any of them. Right now the program simply loops asking for hours, minutes, and delay until I can decide the best way to proceed.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  //Function Prototypes
  void convert(int&amp;, int&amp;, int&amp;, char&amp;);
  void output(int&amp;, int&amp;, char&amp;);
  
  int main()
  {
  
      int hours, minutes, delay;
      char ampm; 
  
      cout&lt;&lt;"Enter the value for Hours (999 to quit):  "&lt;&lt;endl;
      cin &gt;&gt; hours;
  
  
  
      while (hours != 999)
      {
          cout &lt;&lt; "Enter minutes: ";
          cin &gt;&gt; minutes;
  
          cout &lt;&lt; "Enter delay: ";
          cin &gt;&gt; delay;
  
          cout&lt;&lt;"Enter the value for Hours (999 to quit):  "&lt;&lt;endl;
      cin &gt;&gt; hours;
  
  
      }
  return 0;   
  }
  
  
  void convert(int&amp; hours, int&amp; minutes,  int&amp; delay, char&amp; ampm)
  {
  
      if(hours &gt; 12)
      {
          hours  =  hours - 12;
          ampm = 'p';
      }
      else if(hours  == 12) ampm = 'p'; 
      else ampm = 'a'; 
  }
  
  
  void output(int&amp; hours, int&amp; minutes, char&amp; ampm)
  {
      if(ampm == 'p')
      {
          (minutes  &lt; 10); cout &lt;&lt; hours &lt;&lt; ":0" &lt;&lt; minutes &lt;&lt; " P.M."; 
           cout &lt;&lt; hours &lt;&lt; ":" &lt;&lt; minutes &lt;&lt; " P.M.";
      }
      else
      {
          (minutes &lt; 10); cout &lt;&lt; hours &lt;&lt; ":0" &lt;&lt; minutes &lt;&lt; " A.M."; 
           cout &lt;&lt; hours &lt;&lt; ":" &lt;&lt; minutes &lt;&lt; " A.M.";
          }
  
  }
  </code></pre>