title: I can not print a character with accent in c++ if this is alone
body: <p>I need to print the characters of a string (I use VS Code) but separate into a for loop, i don't have problems if I try with words that do not have an accent and the program work, but if i try with an accent word, the program crash (my program is on spanish that's why I need the accent and chars like 'ñ á í...').
  I let you some examples.</p>
  <pre><code>//My simple code
  #include &lt;iostream&gt;
  #include &lt;windows.h&gt;
  
  using namespace std;
  
  int main(){
      SetConsoleOutputCP(65001);
  
      string word = &quot;arbol&quot;; 
  /*
  With this word prints : a - r - b - o - l
  If I put &quot;árbol&quot;, just prints: - 
  */
  
      for (int i = 0; i &lt; 5; i++)
      {
          cout &lt;&lt; word[i] &lt;&lt; &quot; - &quot;;
          
      }
      return 0;
  }
  </code></pre>
  <p>Also, if I don't put the &quot; - &quot; in the end of the cout, any word is printed.
  I know that this is a beginner's question but I don't know what I to do to work it.
  hanks for your help :)</p>