title: Have been trying to convert 12-hour clock format into 24-hour clock format in c++
body: <p>Input is in the format: hh:mm:ssAM or hh:mm:ssPM</p>
  
  <p>Example: </p>
  
  <p>INPUT: 07:05:45PM</p>
  
  <p>OUTPUT: 19:05:45</p>
  
  <pre><code>#include &lt;bits/stdc++.h&gt;
  #include&lt;iostream&gt;
  #include&lt;string&gt;
  
  
  using namespace std;
  
  int main()
  {
      int hh,mm,ss ;
      char tz[2];
  
      cin&gt;&gt;hh&gt;&gt;mm&gt;&gt;ss&gt;&gt;tz;
  
  
      if(strcmp(tz,"AM")==0 &amp;&amp; hh==12)
      {
          hh=0;
      }
  
      else if(strcmp(tz,"PM")==0 &amp;&amp; hh!=12)
      {
          hh += 12;
  
      }
      cout&lt;&lt;hh&lt;&lt;":"&lt;&lt;mm&lt;&lt;":"&lt;&lt;ss;
      return 0;
  }
  </code></pre>
  
  <p>Unlike the expected  output i.e 19:05:45 I am getting 7:0:0</p>