D
D
Denis2021-07-15 14:18:50
C++ / C#
Denis, 2021-07-15 14:18:50

C++ Tic-tac-toe matrix of characters?

How to print a matrix from characters?
For example:
...
...
...
And for example, when collecting user coordinates, output:
...
.x.
...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
cunion, 2021-07-15
@NeYmen

int main(int argc, char** argv)
{
  char symbols[3][3]
  {
    { '.', '.', '.' },
    { '.', '.', '.' },
    { '.', '.', '.' }
  };

  for (int i = 0; i < 3; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      std::cout << symbols[i][j];
    }

    std::cout << std::endl;
  }

  return 0;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question