tic tac toe finding a winner
<p>I am re-posting this with better info on my question. When I run and compile this code; it works fine except for the check for the winner or a tie. I have wrote this loop wrong. It does not find a winner or a tie. Can you please help me with this. Our professor requires us to draw the board with the "*". </p>

<pre><code>   #include &lt;iostream&gt;
#include &lt;cstdlib&gt;
using namespace std;



//Prototypes
void instructions(void);
char init_matrix(char matrix[][3]);
char displaymatrix (char matrix[][3]);
char play_move(char P, char matrix[][3]);
char check(char matrix[][3], char P);

//Main
int main (void)
{
    char matrix[3][3];
    int r, c;
    char P;
    char win;
    win = '*';
    init_matrix(matrix);

    instructions();

    do
    {
        displaymatrix (matrix);
        play_move('X', matrix);
        if (win == 'X' || win == 'O') break;
        displaymatrix (matrix);
        play_move('O', matrix);
        if (win == ('X' || 'O')) break;

    }
    while (win != ('X' || 'O' || '*'));

     if (win == 'X')
        cout &lt;&lt; "Player 1 Wins!";
     else if (win == 'O')
        cout &lt;&lt; "Player 2 Wins!";
     else if (win == '*')
        cout &lt;&lt; "Tie!";
     else cout &lt;&lt; "Error";

     displaymatrix (matrix);
}

//Instructions
void instructions(void)
{
    cout &lt;&lt; "Tic Tac Toe\n";
    cout &lt;&lt; "To enter a move, when it is your turn, enter first a row, then a\n";
    cout &lt;&lt; "column number corresponding with that of the game board you wish to play.\n\n";
}


//Initialize the matrix
char init_matrix(char matrix[][3])
{
    int r, c;

  for(r=0; r&lt;3; r++)
    for(c=0; c&lt;3; c++) matrix[r][c] =  '*';
}

char displaymatrix (char matrix[][3])
{
    int r, c;

    cout &lt;&lt; "        Columns\n";
    cout &lt;&lt; "        1  2  3\n";

    for(r=0; r&lt;3; r++)
    {
        cout &lt;&lt; "Row " &lt;&lt; (r+1) &lt;&lt; ":  ";
        cout &lt;&lt; matrix [r][0];
        cout &lt;&lt; "  ";
        cout &lt;&lt; matrix [r][1];
        cout &lt;&lt; "  ";
        cout &lt;&lt; matrix [r][2];
        cout &lt;&lt; "  " &lt;&lt; endl;
    } 
}

//Player 1 Move
char play_move(char P, char matrix[][3])
{
  int r, c;
  char win;

  do
  {
    cout &lt;&lt; "\nPlayer " &lt;&lt; P &lt;&lt; "\'s Turn \n";
    cout &lt;&lt; "Enter Row: ";
    cin &gt;&gt; r;
    cout &lt;&lt; "Enter Column: ";
    cin &gt;&gt; c;

    r--; c--;

    if (matrix[r][c]!= '*')   //VARIFYS ANY MOVE MADE THAT ANY NUMBER ENTERED MUST BE AN AVAILBLE SLOT
        cout &lt;&lt; "Invalid move. Try Again.";
  }
  while (matrix[r][c]!= '*');

  matrix[r][c] = P;

  check(matrix, P);

  system("cls");
  return win;
}

//See if there is a winner.
char check(char matrix[][3], char P)
{

  int r, c;
  char win;

  for(r=0; r&lt;3; r++)  if (matrix[r][0]==P &amp;&amp; matrix[r][1]==P &amp;&amp; matrix[r][2]==P) win = P ;
  for(c=0; c&lt;3; c++)  if (matrix[0][c]==P &amp;&amp; matrix[1][c]==P &amp;&amp; matrix[2][c]==P) win = P ;
  if (matrix[0][0]==P &amp;&amp; matrix[1][1]==P &amp;&amp; matrix[2][2]==P) win = P ;
  if (matrix[0][2]==P &amp;&amp; matrix[1][1]==P &amp;&amp; matrix[2][0]==P) win = P ;

  return win;
}
</code></pre>

<p><strong>This is the loop....</strong></p>

<pre><code> char check(char matrix[][3], char P)
{

  int r, c;
  char win;

  for(r=0; r&lt;3; r++)  if (matrix[r][0]==P &amp;&amp; matrix[r][1]==P &amp;&amp; matrix[r][2]==P) win = P ;
  for(c=0; c&lt;3; c++)  if (matrix[0][c]==P &amp;&amp; matrix[1][c]==P &amp;&amp; matrix[2][c]==P) win = P ;
  if (matrix[0][0]==P &amp;&amp; matrix[1][1]==P &amp;&amp; matrix[2][2]==P) win = P ;
  if (matrix[0][2]==P &amp;&amp; matrix[1][1]==P &amp;&amp; matrix[2][0]==P) win = P ;

  return win;
</code></pre>
