This has been discussed and explained many times on this forum. You must not string together multiple increments or assignments on the same cout line. You must separate each one with a semicolon.
// BAD BAD BAD YOU MUST NEVER DO THIS
int i=20;
cout<<i<<i++<<i++<<i++;
// This is OK
int i=20;
cout << i; // 20
cout << i++; // 20
cout << i++; // 21
cout << i++; // 22
// at this point i==23
I see... in the 2nd snippet in line 8 it storing the new value of i and it will only start storing if the ++ (incrementation) has performed. Therefore if only I then I then I the output would only be 20202020