title: c++ read each 3 elements in array
body: <p>I am working on a project and i want to print in order each 3 elements of a string array.So if the string is "cadgfacbda" i want to be printed in the console : </p>
  
  <blockquote>
    <p>**"cad gfa cbd a"**</p>
  </blockquote>
  
  <p>This is the code :</p>
  
  <pre><code>        string str("cadgfacbda");
          for(int i = 0 ; i &lt; 3 ; i++)
          {
              for(int j = i ; j &lt;  str.size() ; j +=3 )
              {
                 cout &lt;&lt; str[j]&lt;&lt;" ";
              }
          cout&lt;&lt;endl;
      }
  </code></pre>
  
  <p>But what i get is : </p>
  
  <blockquote>
    <p>c g c a</p>
    
    <p>a f b</p>
    
    <p>d a d</p>
  </blockquote>