title: C++ time difference in military time
body: <p>I'm trying to create a program that takes the difference of two military times and get its time difference.</p>
  
  <p><code>Example:</code></p>
  
  <p><code>**AM to PM**</code></p>
  
  <p><code>Time 1: 0900</code> </p>
  
  <p><code>Time 2: 1730</code></p>
  
  <p><code>Time Difference: 8 hours 30 minutes</code></p>
  
  <p><code>**PM to AM**</code></p>
  
  <p><code>Time 1: 1200</code></p>
  
  <p><code>Time 2: 1100</code></p>
  
  <p><code>Time Difference: 23 hours 0 minutes</code></p>
  
  <p>Using a couple of if than else statements, I was able to figure out how to convert from military hours into standard hours but I'm stuck with how to go about subtracting time. I was trying to come up with a way to do with on paper just with addition and subtraction but I haven't developed a method that works in all cases. Any help?  </p>