I am having problem with my printError function. It handles incorrect input from user dealing with the numerical range. However, on the second condition being evaluated (dealing with character selection for the pattern) I always recieve "Invalid character.", even if the selection is of an eligible type. Here's my code:
Thanks for any help on this others may have!
Code:
/ Definition of printError which determines if user has entered *
// acceptable input. *
//************************************************** **********************
void printError(int& rows, char& characterSelect)
{
if ((rows < 2) || (rows > 14) || (rows%2 != 0))
{
cout << "\nInvalid number of rows. Please retry.\n";
cout << "\n";
getInput(rows, characterSelect);
}
else if ((characterSelect != '*') || (characterSelect != '+') || (characterSelect != '#') || (characterSelect != '$'))
{
cout << "\nInvalid character. Please retry using one of the four characters given.\n";
cout << "\n";
getInput(rows, characterSelect);
}
}
Comment