title: I am not able to understand the concept how string is converted to integers
body: <p>I referred a program for time conversion and not able to understand some part of the code. Here's the full program.</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;cstdio&gt;
  
  using namespace std;
  
  int main() {
      string s;
      cin &gt;&gt; s;
  
      int n = s.length();
      int hh, mm, ss;
      hh = (s[0] - '0') * 10 + (s[1] - '0');
      mm = (s[3] - '0') * 10 + (s[4] - '0');
      ss = (s[6] - '0') * 10 + (s[7] - '0');
  
      if (hh &lt; 12 &amp;&amp; s[8] == 'P') hh += 12;
      if (hh == 12 &amp;&amp; s[8] == 'A') hh = 0;
  
      printf("%02d:%02d:%02d\n", hh, mm, ss);
  
      return 0;
  }
  </code></pre>
  
  <p>The part of code i am not able to understand is</p>
  
  <pre><code>    hh = (s[0] - '0') * 10 + (s[1] - '0');
      mm = (s[3] - '0') * 10 + (s[4] - '0');
      ss = (s[6] - '0') * 10 + (s[7] - '0');
  </code></pre>
  
  <p>Thanks in advance.</p>