title: Why is my isdigit() function returning the ascii code instead of the int, and how do I prevent it?
body: <p>The following code snippet is supposed to run through a vector of strings (words), and if the string contains an integer, it should push the int to an integer vector (nums) that contains only those numbers.</p>
  
  <pre><code>for (int i = 0; i &lt; words.size(); i++){
      for(int j = 0; j &lt; words.at(i).size(); j++){
          if (isdigit(words[i][j])){
              nums.push_back(words[i][j]);
          }
      }
      cout &lt;&lt; words.at(i) &lt;&lt; endl;
  }
  </code></pre>
  
  <p>I've been given a file with the words on it. My code successfully pulls the words from the file and places them in a vector. However, my isdigit() function is not returning the expected values. The words are ho1d
  h4m,
  dance2,
  8est,
  next,
  di6est,
  se3d,
  tes7 and my expected value for the nums vector is 1,4,2,8,6,3,7. Here's my print snippet:</p>
  
  <pre><code>for (int i = 0; i &lt; nums.size(); i++){
          cout &lt;&lt; nums.at(i) &lt;&lt; " ";
      }
  </code></pre>
  
  <p>But it's returning the values 49 52 50 56 54 51 55. EDIT: Just recognized that these are the ascii values. How do I prevent them from pushing the ascii values instead of the integers? I've even tried to use the get() function and run through every character instead of every line while reading the input, and I still get the same values returned. Where am I going wrong?</p>