Hi! I want to know what's my mistake in my code but in myself, i know, I haven't done anything wrong. So here's my question about the || operator, please see my code. I know i did correct but when I enter "x" or "X", it doesn't exit properly.
#include <iostream>
#include <string>
usingnamespace std;
int main() {
char input;
do {
cout << "Welcome to learning lad" << endl;
cout << "This is where you can learn much more" << endl;
cout << "If you wish to exit, press x, if not, press any other key" << endl;
cin >> input;
} while( input != 'x' || input != 'X');
return 0;
}
// while( input != 'x' || input != 'X');
while( input != 'x' && input != 'X'); // input is not 'x' and input is not 'X'
// ie. input is not one of { 'x', 'X' }