Why there is IF() output every time?
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#include <iostream>
int main(){
char c;
while(c!='x'){
std::cout << "Enter c: ";
std::cin >> c;
if (c!='1' || c!='0')
std::cout << "Error input\n";//???
}
return 0;
}
|
c either doesn't equal 1 or it doesn't equal 0. Sounds true to me.
Replace the or with and.
Thanks!
Topic archived. No new replies allowed.