for(int i = 0; i < 9; i=i){ cout << " " << i++ << " | " << i++ << " | " << i++ << "\n"; //avoids printing a line at the end of the board if(i != 9){ cout << "-----------\n"; } } outputs: 2 | 1 | 0 ----------- 5 | 4 | 3 ----------- 8 | 7 | 6