Posted on 2004-09-13
I'm having trouble with a scanf portion of code. The program asks for a single character A, B, or C. If the user enters anything other than those three choices, the program is supposed to ask them to reenter the correct character. I used an if statement to check the character entered but the segment of code isn't working right. It prints out the code asking for the new character twice and then goes onto the next segment of code. Here is the portion of code causing the trouble.
printf("Enter the character>");
dChar = toupper(dChar);
if ((dChar != 'A') || (dChar != 'B') || (dChar != 'C'))
printf("Please enter in either an A, B, or C>");
Could you tell me what the problem is please?