This is an infinite loop:
while(option1!=1 || option1!=2)
Since option1
can never simultaneously equal both 1
and 2
, then this condition will always evaluate to true
and the loop will always continue. You probably meant to use the logical "and" operator (&&
) in your comparison:
while(option1!=1 && option1!=2)
That way the loop will end if option1
ever equals one of those two options.