title: 24 hour clock to standard
body: <p>I am writing a program for class where it converts from military time to standard. Everything else seems to be working fine until I type in 60 for the minutes. For example if I type 23:60 it gives me 11:60 PM which is incorrect. How do I fix this? I tried checking if minutes == 60  to reset minutes to 0 but I cant figure it out.</p>
  
  <pre><code>#include &lt;iostream&gt; 
  
  using namespace std;
  
  void inputData(int&amp;, int&amp;, char&amp;); // this function asks users to input 
  information
  void convertData(int&amp;, int&amp;, char&amp;); // this converts the military time to 
  standard time
  int outputData(int&amp;, int&amp;, char&amp;);  // this function puts all the other 
  information together to output certain data
  int main ()
  {
  int hours, minutes;
  char am_pm;
  char trueValue;
  
  do
  {
      inputData(hours, minutes, am_pm); // calls to input function
      convertData(hours, minutes, am_pm); // calls to the conversion function
      outputData(hours, minutes, am_pm); // calls to function that outputs all 
  the data
      cout &lt;&lt; "Would you like another conversion? Type Y or y to repeat." &lt;&lt; 
  endl;
      cin &gt;&gt; trueValue;
  }
  
  while (trueValue == 'y'|| trueValue == 'Y');
  
  if (trueValue != 'y' || trueValue != 'Y')
      cout &lt;&lt; "Thanks for using this converter. Have a nice day." &lt;&lt; endl;
  
  return 0;
  }
  
  void inputData (int &amp;hours, int &amp;minutes, char &amp;am_pm)
  {
  cout &lt;&lt; "Please enter hours (less than or equal to 24): "; // ask user to 
  input hours.
  do
  {
      cin &gt;&gt; hours;
      if (hours &gt; 24)
          cout &lt;&lt; "ERROR! Must be less than 24" &lt;&lt; endl;
  } 
  while (hours &gt; 24); // end of hours loop
  
  cout &lt;&lt; "Please enter minutes (less than or equal to 60): "; // ask user to 
  input minutes.
  do
  {
      cin &gt;&gt; minutes;
      if (minutes &gt; 60)
      {
          cout &lt;&lt; "Must be less than 60. Try again!" &lt;&lt; endl;
      }
  }
  while (minutes &gt; 60); //end of minutes loop
  cout &lt;&lt; endl;
  cout &lt;&lt; "You have entered: " &lt;&lt; hours &lt;&lt; ":" &lt;&lt; minutes; // display what 
  user inputs together.
  cout &lt;&lt; endl;
  
  }
  
  void convertData(int &amp;hours, int &amp;minutes, char &amp;am_pm)
  { 
  if (minutes == 60)
  {
      hours++; // add an hour to 'hours'
      minutes = minutes/60;
  
  }
  
  
  if (hours &lt; 12)
  {
      hours = 12-12+1;
  }
  if (hours &gt; 12)
  {
      hours = hours - 12; // subtracts anything bigger than 12 to get standard 
  time. Anything over 12 is PM according to project instruction
      am_pm = 'P';
  }
  else
  if (hours == 12) 
  {
      am_pm = 'P';
  }
  else
  am_pm = 'A';
  }
  
  
  int outputData(int &amp;hours, int &amp;minutes, char &amp;am_pm)
  {   
  
  if (am_pm == 'P')
  cout &lt;&lt;"Your standard time is: " &lt;&lt; hours &lt;&lt; ":" &lt;&lt; minutes &lt;&lt; " P.M" &lt;&lt; 
  endl;
  else
  cout &lt;&lt;"Your standard time is: " &lt;&lt; hours &lt;&lt; ":" &lt;&lt; minutes &lt;&lt; " A.M" &lt;&lt; 
  endl;
  }
  </code></pre>