Simple Tic Tac Toe Game

Hey guys, I'm trying to make a simple Winform tic tac toe game. I have all buttons to react to a button click. I want the turns to switch automatically. Program runs without error but only outputs X when I click the various buttons. How could I get them to switch each turn?

Here is the code:


#pragma endregion

private: System::Void button_click(System::Object^ sender, System::EventArgs^ e) {
int turn = 1;

Button^ button = (Button^)sender ;
if (turn>0)
button->Text = " X " ;
else button->Text = " O " ;
turn = turn*-1;
button->Enabled=false;
Topic archived. No new replies allowed.