title: Changing values of arrays
body: <p>I'm new to c++ and as my first assignment was to make a game of reversi, but I'm having problems when it comes to the input of the players in the playGame function. So when i cin x and y, it will change the value of the board array[x][y] from empty or '' to 'B'. I also don't know how to refer the array to the function. I'm sorry if these questions are silly to some but forgive me I'm self-learning here. Thanks</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  void displayTop();
  void displayAlpha();
  void displayNum();
  int displayMenu();
  void displayBoard();
  char displayHelp();
  void playGame();
  int num = 8;
  char board [8][8] = {
  
  ' ',' ',' ',' ',' ',' ',' ',' ',
  ' ',' ',' ',' ',' ',' ',' ',' ',
  ' ',' ',' ',' ',' ',' ',' ',' ',
  ' ',' ',' ','W','B',' ',' ',' ',
  ' ',' ',' ','B','W',' ',' ',' ',
  ' ',' ',' ',' ',' ',' ',' ',' ',
  ' ',' ',' ',' ',' ',' ',' ',' ',
  ' ',' ',' ',' ',' ',' ',' ',' ',
  
  };
  
  int main() {
      int choice = displayMenu();
      switch (choice) {
          case 1:
              displayBoard();
              break;
          case 2:
              displayHelp();
              break;
          default:
              cout &lt;&lt; "Please enter a valid choice." &lt;&lt; endl;
              break;
      }
      playGame();
  
  }
  void displayBoard(){
  
  
      displayTop();
  
      for (int row = 0; row &lt; 8; row++){
          displayNum();
          cout &lt;&lt; "   |";
  
          for (int column = 0; column &lt; 8; column++){
              cout &lt;&lt; board[row][column] &lt;&lt; "   |";
          }
          cout &lt;&lt; endl;
          displayTop();
  
      }
  
      displayAlpha();
  
  }
  
  void displayTop(){
      cout &lt;&lt; "    ";
      for (int i = 0; i &lt; 8; i++){
          cout &lt;&lt; "+----";
      }
      cout &lt;&lt; endl;
  
  }
  
  void displayAlpha(){
      cout &lt;&lt; "   ";
      for( char i = 'a'; i &lt;= 'h'; i++ ) {
      cout &lt;&lt; "    " &lt;&lt; i ;
      }
  }
  
  void displayNum(){
      if (num &gt; 0) {
          cout &lt;&lt; num;
          num = num - 1;
  
      }
  }
  
  int displayMenu(){
      int answer = 0;
      cout &lt;&lt; "Othello\n\n"
      &lt;&lt; "1.New Game\n2.Help\n3.Quit\nYour Choice: ";
      cin &gt;&gt; answer;
      system("clear");
      return answer;
  
  }
  
  char displayHelp(){
      char answer = ' ';
      cout &lt;&lt; "How to play Othello\n\nThe object of the game is to have     the majority of your colour discs on the board at the end of the     game.\n\nInput the cell where you want to place your disc in the form of     (a-z 1-8) without the bracket and includng the space.\n\nThe one with the     most discs wins!!!!\n\nSo, are you ready to play? (y or n)\n\nYour Choice:    ";
      cin &gt;&gt; answer;
      if (answer == 'y')
          displayBoard();
  
      return answer;
  }
  
  void playGame(){
      int plW = 2;
      int plB = 2;
      int x = 0;
      int y = 0;
      char player = 'B';
      for(;;){
          cout &lt;&lt; "\n\nScore: W = " &lt;&lt; plW &lt;&lt; " B = " &lt;&lt; plB;
          cout &lt;&lt; "\nPlayer: " &lt;&lt; player;
          cout &lt;&lt; "\nPlease make your move : ";
          cin &gt;&gt; x &gt;&gt; y;
          cout &lt;&lt; endl;
  
          if (x &lt; 9 &amp;&amp; y &lt; 9) {
              board[x-1][y-1] = player;
              displayBoard();
          } else {
              cout &lt;&lt; "Invalid Input";
          }
  
          if (player == 'B') {
              plB++;
              player = 'W';
  
          } else {
              plW++;
              player = 'B';
          }
      }
  
  }
  </code></pre>