I've tried this several different ways, and just can't seem to get it to work. This is the section I'm working with:
1 2 3 4 5 6 7 8 9 10
if ( (package == 'Q') || (package == 'q' ) )
{
cout << "Thank you for using this program. Goodbye." << endl;
return 0;
}
elseif ( (package != 'a') || (package != 'A') )
{
cout << "Enter only A, B, C, or Q.\n" << endl;
continue;
}
The first part works -- if I enter a 'Q' or 'q' the program displays that line and terminates. I'm trying to get the second part to start the program over if PACKAGE does not equal A, a, B, b, C, or c. (I have just A and a for testing purposes at this time). Thanks for any assistance.
Character Different from 'a' Different from 'A''x' 1 1
'X' 1 1
'B' 1 1
'a' 0 1
'A' 1 0
( x != 'a' || x != 'A' ) is equivalent to ( !( x == 'a' && x == 'A' ) )
Is there any character that is equal to both 'a' and 'A' at the same time? Can you figure out what needs to be changed to make the condition make sense?
Well I have to have two different inputs. Here's everything I have now... I'm not looking for someone to do it for me... I want to know where I'm going wrong and how to fix it. The program is supposed to loop unless Q or q is entered. Right now it terminates if anything other than a,b,c,q is entered, and only after the number of units is entered, but should display the error BEFORE querying for the number of units then looping back to the beginning of the program. Anyway, here it is... and thanks for all of your help. Hopefully I'll get this soon enough.