Question about not allowing a character

Greetings..i,m relatively new to programming and am working on a project for class...i am trying to nail down a statement i can input in my program to disallow the use of characters or words. here is my function that I'm working in

what happens is the user inputs a column to move to and this checks his move for validity. I'm not sure of the command to stop from entering characters...i would normally do if(col !=0 && col !=1...etc but that would negate the first if statement. any help would be appreciated.


bool Board::checkMove(int col)
{
// if outside of legal column values, return false
if (col < 0 || col > 6)
return false;
if (col )
// if column is full, return false
if (board[0][col] != 'e')
return false;
// otherwise, it's ok
return true;




Last edited on
Topic archived. No new replies allowed.