title: Converting string to ASCII
body: <p>I was just trying something out and made the following code. It is supposed to take each individual letter in a string and print its ASCII equivalent. However, when there is a space, it stops converting. Here is the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  void convertToASCII(string letter)
  {
      for (int i = 0; i &lt; letter.length(); i++)
      {
          char x = letter.at(i);
          cout &lt;&lt; int(x) &lt;&lt; endl;
      }
  }
  
  int main()
  {
      string plainText;
      cout &lt;&lt; "Enter text to convert to ASCII: ";
      cin &gt;&gt; plainText;
      convertToASCII(plainText);
      return 0;
  }
  </code></pre>
  
  <p>Any ideas on why this happens?</p>