title: Converting time into Hours, minutes, and seconds
body: <p>I was writing a c++ program that converts time into: hours, minutes, and seconds. <br> 
  What I need to do is to convert time into the form of: HH:MM:SS, anyways <br> here is my code: <br></p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main() {
      long time, hour, min, sec;
      cout&lt;&lt;"Enter elapsed time: ";
      cin&gt;&gt;time;
      cout&lt;&lt;time;
      hour = time/3600;
      min = (time%3600) / 60;
      sec = (time%3600) % 60;
      cout&lt;&lt;"\nIn HH:MM:SS -&gt; ";
      cout&lt;&lt;hour&lt;&lt;":"&lt;&lt;min&lt;&lt;":"&lt;&lt;sec;
      return 0;
  }
  </code></pre>
  
  <p><br> When I enter time in example: 3600, it displays 1:0:0 unlike the form I'm looking forward, so I need it to be displayed as "01:00:00" in this form. What should I do?</p>