Allowing only integer values from the user
<pre><code>void GetMoveCoordinates(int &amp;layercoordinate, int &amp;XCoordinate, int &amp;YCoordinate){
    if(CurrentSymbol == PlayerOneSymbol){
        cout &lt;&lt; PlayerOneName &lt;&lt; " its your turn, you are: " &lt;&lt; CurrentSymbol;
    }
    else {
        cout &lt;&lt; PlayerTwoName &lt;&lt; " its your turn, you are: " &lt;&lt; CurrentSymbol;
    }
    //cout &lt;&lt; "its " &lt;&lt; CurrentSymbol &lt;&lt; "s turn";
    cout &lt;&lt; endl;
    cout &lt;&lt; "Enter layer: ";
    cin &gt;&gt; layercoordinate;
    cout &lt;&lt; "Enter x coordinate: ";
    cin &gt;&gt; XCoordinate;
    cout &lt;&lt; "Enter y coordinate: ";
    cin &gt;&gt; YCoordinate;
    cout &lt;&lt; endl;
}



int CheckValidMove(int layercoordinate, int XCoordinate, int YCoordinate, char Board[4][4][4]){
    int ValidMove;
    ValidMove = 1; 
    // check layer coordinate is valid
    *if (!((layercoordinate == 1) || (layercoordinate == 2) || (layercoordinate == 3))){
        ValidMove = 0;
    }*/

    // check x coordinate is valid
    if (!((XCoordinate == 1) || (XCoordinate == 2) || (XCoordinate == 3))){
        ValidMove = 0;
    }

    // check y coordinate is valid
    if (!((YCoordinate == 1) || (YCoordinate == 2) || (YCoordinate == 3))){
        ValidMove = 0;
    }

    // check space is free
    if (Board[layercoordinate][XCoordinate][YCoordinate] != ' '){
        ValidMove = 0;
    }
    return ValidMove;
}
</code></pre>

<p>my current code checks weather the value entered if an integer is 1 2 or 3 however if the user is to enter a character it doesn't seem to be able to handle it and some kind of continuous loop starts.. i've tried a few things but i'm really stuck any help please?</p>
