So having some trouble with the error checking in the below function.
Currently if you enter something wrong like r it returns "Pleae Enter next move" which is correct. My problem is that if I enter rrr it will repeat "Please enter..." 3 times instead of just once.
I hope that makes sense. Any help would be great. Thanks,
cout<<"Please enter next move : ";
cin>>dir;
if( dir== 'i')
{
print_instructions();
continue;
}
else if( dir=='q')
{
break;
}
else
{
char p;
cin>>p;
const char * temp;
temp= &p;
rowcol= atoi(temp);
if((dir == 'h' && row<=1 && rowcol<=ROWS) || (dir == 'v' && col<=2 && rowcol<=COLS) )
{
movePuzzle(puzzle, dir,rowcol);
print_puzzle(puzzle);
flag = is_winning_state(puzzle);
}
else
{
continue;
}