   C++ n00b Needs Help
  Hello,I was making a tic tac toe game, just for fun, and i came across a problem just running the program. Its not done yet, but with the point where its at, it should work ok. Somethings wrong with the PLAYING GAME FUNCTION i think, but im not sure. Please, post any help! Thanks for any help, suggestions, advice [smile]P.S. - I got a plethora of errors saying missing ";" after "." (where the vector  is) and syntax errors with the "if" statements. ( all of the errors are in the playing game function )#include "stdafx.h"#include <iostream>#include <string>#include <vector>using namespace std;#define ROWS = 3;#define COLUMNS = 3;///////////////////////////////////////////////////////////////////////////////////////////// QUIT GAME FUNCTION///////////////////////////////////////////////////////////////////////////////////////////void quitGame(){system("CLS");    cout << "|================================|\n" << "|  |\n" << "|Thank You for Playing!|\n" << "|  |\n" << "|--------------------------------|\n" << "|  |\n" << "|    Bye.    |\n" << "|  |\n" << "|================================|\n\n";system("PAUSE");}///////////////////////////////////////////////////////////////////////////////////////////// INVALID OPTION FUNCTION///////////////////////////////////////////////////////////////////////////////////////////void invalidOption(){system("CLS");char menu;cout << endl << endl;    cout << "\t\t\t|===========================|\n" << "\t\t\t|  |\n" << "\t\t\t|    Welcome!|\n" << "\t\t\t|  |\n" << "\t\t\t|---------------------------|\n" << "\t\t\t|  |\n" << "\t\t\t|    (P) Play   (Q) Quit    |\n" << "\t\t\t|  |\n" << "\t\t\t|---------------------------|\n" << "\t\t\t|  |\n" << "\t\t\t| Game Created By |\n" << "\t\t\t|Brand0n The Great|\n" << "\t\t\t|  |\n" << "\t\t\t|===========================|\n\n" << endl << "\t\t\t\tMenu Selection: ";cin >> menu;}///////////////////////////////////////////////////////////////////////////////////////////// PLAY GAME FUNCTION///////////////////////////////////////////////////////////////////////////////////////////vector<string> board;board.push_back("1");board.push_back("2");board.push_back("3");board.push_back("4");board.push_back("5");board.push_back("6");board.push_back("7");board.push_back("8");board.push_back("9");string move;    cout << "  " << board[0] << " | " << board[1] << " | " << board[2] << endl << "=================\n" << "  " << board[3] << " | " << board[4] << " | " << board[5] << endl << "=================\n" << "  " << board[6] << " | " << board[7] << " | " << board[8] << endl << endl << "Your Move: ";cin >> move;//TESTING KEYSif(move == 1)board[0] = "X";if(move == 2)board[1] = "X";if(move == 3)board[2] = "X";if(move == 4)board[3] = "X";if(move == 5)board[4] = "X";if(move == 6)board[5] = "X";if(move == 7)board[6] = "X";if(move == 8)board[7] = "X";if(move == 9)board[8] = "X";// CHECKING IF PLAYER WONif(board[0] == "X" && board[1] == "X" && board[2] == "X"){cout << "\nGood Job! You Won!\n\n";quitGame();}if(board[0] == "X" && board[4] == "X" && board[8] == "X"){cout << "\nGood Job! You Won!\n\n";quitGame();}if(board[0] == "X" && board[3] == "X" && board[6] == "X"){cout << "\nGood Job! You Won!\n\n";quitGame();}if(board[1] == "X" && board[4] == "X" && board[7] == "X"){cout << "\nGood Job! You Won!\n\n";quitGame();}if(board[2] == "X" && board[5] == "X" && board[8] == "X"){cout << "\nGood Job! You Won!\n\n";quitGame();}if(board[6] == "X" && board[7] == "X" && board[8] == "X"){cout << "\nGood Job! You Won!\n\n";quitGame();}///////////////////////////////////////////////////////////////////////////////////////////// MAIN FUNCTION///////////////////////////////////////////////////////////////////////////////////////////int _tmain(int argc, _TCHAR* argv[]){   char menu;    cout << endl << endl;    cout << "\t\t\t|===========================|\n"    << "\t\t\t|  |\n" << "\t\t\t|    Welcome!|\n" << "\t\t\t|  |\n" << "\t\t\t|---------------------------|\n" << "\t\t\t|  |\n" << "\t\t\t|    (P) Play   (Q) Quit    |\n" << "\t\t\t|  |\n" << "\t\t\t|---------------------------|\n" << "\t\t\t|  |\n" << "\t\t\t| Game Created By |\n" << "\t\t\t|Brand0n The Great|\n" << "\t\t\t|  |\n" << "\t\t\t|===========================|\n\n" << endl << "\t\t\t\tMenu Selection: ";cin >> menu;if(menu == 'p')void playGame();else if(menu == 'q')void quitGame();elsevoid invalidOption();return 0;}[Edited by - NUCLEAR RABBIT on May 25, 2006 12:18:10 AM]
  Down at the bottom, where you are in main, and you call your various functions, you are putting 'void' in front of them, like when you declared and defined them. You do not need those flags just to call the function.Like you would do:void DoThis(){...}and later in your code, call it like this.int main(){DoThis()}understand?   ;  At a quick glance, your "Play Game" function isn't actually a function. Its statements aren't enclosed in anything.You want something like:void play_game(){   // contents go here}   ;  Agree with Anon ... the code you've written for the "Play Game" function hasn't actually been enclosed properly within a function block. I would imagine this is what is giving rise to all of the syntax errors ...Phil H   ;  Your defines are wrong, but I don't think it is causing a problem yet because you haven't used them.  You don't do this:#define SOMETHING = 3;but rather this:#define SOMETHING 3That is it, nothing else.  In your code if you did this:#define SOMETHING = 3;int main()  int variable_name = 3;  cout << variable_name * SOMETHING;  return 0;}You would have some weird stuff on your hands because that expands to this:int main()  int variable_name 3;  cout << variable_name * = 3;;  return 0;}Defines are of the form:#define SYMBOL stuff_to_replace_symbol_withIf there is nothing after SYMBOL then you replace SYMBOL with nothing.  Not sure about your current error though, but hope this helped all the same.   ;  Thank you everyone for all your help. I missed some pretty simple things...guess thats what happenes when you take a week off programming [lol]. Well, Thanks again for all the help.   