for game square

Hello,how me need square 3x3 for game?? Somebody knows?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 int main()
{
	const int row=3;
	const int col=3;
	int arr[row][col];

  for(int i=0;i<row;i++)
	{
		for(int j=0;j<col;j++)
		{
			arr[i][j]=' ';
		}
	}

	for(int i=0;i<row;i++)
	{
		arr[1][j]='_';
		arr[3][j]='_';
	}
	for(int j=0;j<col;j++)
	{
		arr[i][1]='|';
		arr[i][3]='|';
	}
  return 0;
What are you trying to do? Please use better English. Thank you!
i'm need field in the cell.
Not sure what is needed. This will at least compile and run:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream> 

using namespace std; 

int main()
{
    const int row=3;
    const int col=3;
    char arr[row][col];

    for (int i=0;i<row;i++)
    {
        for (int j=0;j<col;j++)
        {
            arr[i][j] = ' ';
        }
    }

    for (int i=0;i<row;i++)
    {
        arr[i][0] = '_';
        arr[i][2] = '_';
    }
    
    for (int j=0;j<col;j++)
    {
        arr[0][j] ='|';
        arr[2][j] ='|';
    }
    
    
    for (int i=0;i<row;i++)
    {
        for (int j=0;j<col;j++)
        {
            cout << arr[i][j];
        }
        cout << '\n';
    }
     
}

This is the output:
|||
_ _
|||


... but my instinct says this might be something to do with the game of "Noughts and Crosses" or "tic tac toe".


Topic archived. No new replies allowed.