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 :
**"cad gfa cbd a"**
This is the code :
string str("cadgfacbda");
for(int i = 0 ; i < 3 ; i++)
{
for(int j = i ; j < str.size() ; j +=3 )
{
cout << str[j]<<" ";
}
cout<<endl;
}
But what i get is :
c g c a
a f b
d a d