wierd error!
-
void player_move(){ int a = 0; g: cout << "Enter valid move (1-9):"; cin a; // line containing error if(a >= 1 && a <= 9){ if(a == 1 && b1 == " ") b1 == "O"; if(a == 2 && b2 == " ") b2 == "O"; if(a == 3 && b3 == " ") b3 == "O"; if(a == 4 && b4 == " ") b4 == "O"; if(a == 5 && b5 == " ") b5 == "O"; if(a == 6 && b6 == " ") b6 == "O"; if(a == 7 && b7 == " ") b7 == "O"; if(a == 8 && b8 == " ") b8 == "O"; if(a == 9 && b9 == " ") b9 == "O"; } else goto g; }
The line that contains the error gives this "error C2146: syntax error : missing ';' before identifier 'a'" Can anyone help me try to explain why this is happening becuase when I do what the compiler says it compiles fine. please help.:confused::confused: Actual Linux Penguins were harmed in the creation of this message. -
void player_move(){ int a = 0; g: cout << "Enter valid move (1-9):"; cin a; // line containing error if(a >= 1 && a <= 9){ if(a == 1 && b1 == " ") b1 == "O"; if(a == 2 && b2 == " ") b2 == "O"; if(a == 3 && b3 == " ") b3 == "O"; if(a == 4 && b4 == " ") b4 == "O"; if(a == 5 && b5 == " ") b5 == "O"; if(a == 6 && b6 == " ") b6 == "O"; if(a == 7 && b7 == " ") b7 == "O"; if(a == 8 && b8 == " ") b8 == "O"; if(a == 9 && b9 == " ") b9 == "O"; } else goto g; }
The line that contains the error gives this "error C2146: syntax error : missing ';' before identifier 'a'" Can anyone help me try to explain why this is happening becuase when I do what the compiler says it compiles fine. please help.:confused::confused: Actual Linux Penguins were harmed in the creation of this message.Try
cin >> a;
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
Try
cin >> a;
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"