variable int with other type of value

hey guys, I'm new at c++ programming and i have a few question but this one is killin me. look a sample code i created to show what i want to do
1
2
3
4
5
6
7
8
9
cout << escolhaJog;
while (escolhaJog != 1 || escolhaJog != 0){
     cout << "Incorrect Value. Type Again...";
\\   cout << escolhaJog;
\\   if (escolhaJog < 0 || escolhaJog > 9){
\\			;
\\      }
     cin >> escolhaJog;
}


here i want the user to enter the value 1 or 0 form the keyboard (quite simple). so i created a condition if he typed differente values escolhaJog != 1 || escolhaJog != 0. But my problem comes when the user type a character. And this character is stored in the variable escolhaJog, which was defined as short integer. I tried a lot of stuffs but i always stuck in an infinite loop, everytime i try to create a char condition (maybe is where im doing wrong). I would like to now: there is a way to do this, a condition which avoid the user type characters and then print in the screen cout << "Incorrect Value. Type Again..."; and give him a chance to type again?
ty guys
Last edited on
This article should help you: http://www.cplusplus.com/forum/articles/6046/
What does "escolhaJog" mean?
Topic archived. No new replies allowed.