ignore() function will work
Use char instead because if you enter a character, it will go crazy.
and also, the (character != 1 || ... ) part is not right, you enter any number it will still go into that loop again because it did not satisify all the demands:
if you entered '1', the comp will process: (character!= '1' || ...) ok pass, but when it goes into the second one (...||character !='2'...) it does not satisify this so it will go back to that loop.
Solution make every "||" into "&&"
Hope this will help