Tic Tac toe

I'm building a tic tac toe program with multiple players. Each player has a symbol char as a place marker, which is stored in a vector.

vector<char> symbol;

I need to switch players in my game loop so the correct CHAR is used when I place the marker.

char currentPlayer = symbol[*myPointer - 1];

The problem is I can only get it to switch one time...


http://pastebin.com/jE1gZuDi


I'm very new to c++ so any tips or questions as to why I did certain things are much appreciated.

FYI: I'm still working on functions (checkForVictory, tieGame...ect)
*myPointer++; // increments myPointer, so that it no longer points at what it previously pointed to.

Why are you using a pointer here at all?
AHA!

Thanks. Pointers are confusing but I didn't need it!

//THIS WORKS!

if (count == (numPlayers)) {
count = 1;
currentPlayer = symbol[count - 1];
}
//SWITCH PLAYERS
else {
count++;
currentPlayer = symbol[count -1];
}

Is there anything else that looks really wacky?
Last edited on
Topic archived. No new replies allowed.