// Ch. 15 Demo Program #3
// Mr. Minich
// Purpose - to illustrate passing an apmatrix by reference


#include <iostream.h>
#include "M:\C++ Programming\AP classes\apmatrix.h"

void move(apmatrix <char> &);           // places X on the tic tac toe board
        
int main()                                              
{
  apmatrix <char> board(3, 3, 'O');       // 3 by 3 tic tac board initialized with zeros

  int row;                              // row of tic tac toe board
  int col;                              // column of tic tac toe board

  move(board);                          // making tic tac move
 
  //********* displaying tic tac toe board ***********

  for(row = 0; row < board.numrows(); row++)
  {

    for(col = 0; col < board.numcols(); col++)
    {
      cout << board [row][col] << ' ';  // printing elements with spaces 
    }                                   // in between

    cout << endl << endl;
  }

  return 0;
}// end of main

void move(apmatrix <char> & board)
{
        board[2][2] = 'X';      
                                
}// end of move