using stringstream draw Tic Tac Toe

Hi,
I want use stringstream to draw my board

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  cout <<            "\n\n\tTic Tac Toe\n\n";

	
	cout << endl;

	cout << "     |     |     " << endl;
	cout << "  " << board[0] << "  |  " << board[1] << "  |  " << board[2] << endl;

	cout << "_____|_____|_____" << endl;
	cout << "     |     |     " << endl;

	cout << "  " << board[3] << "  |  " << board[4] << "  |  " << board[5] << endl;

	cout << "_____|_____|_____" << endl;
	cout << "     |     |     " << endl;

	cout << "  " << board[6] << "  |  " << board[7] << "  |  " << board[8] << endl;

	cout << "     |     |     " << endl << endl;
Replace "cout" with the name of your std::stringstream variable.
Don't forget to #include <sstream> .

To generate the string from a stringstream, use my_stringstream.str()
Last edited on
Topic archived. No new replies allowed.