How to Replace Bits of Strings

I am making a tic-tack-toe game, and I don't know how to make the board replace a space with an x or an o. For example, I need the board, which one row looks like this
| | | |
-------
to be able to change to this
|X| | |
-------
and be able to put the X(or O) anywhere that the space is on the line.
Last edited on
How are you storing your string?

And how are you displaying it, for that matter?

Andy
Last edited on
I have a string called board_lines that is the | | | |
and another string called board_dashes that is the -------
They make up the board by putting them all together with cout.

I'm trying to make a function where you select where you want the X to be in the column by using numbers that correspond to where it would be on the board. For example, if you wanted an X in the first column, you would say that you wanted it in position 2.
Have you looked at how other people have done it?
http://runnable.com/U_bAcOEL2s1XrnH_/c%2B%2B-tic-tac-toe-game-for-array
Topic archived. No new replies allowed.