Any shortened version of this code?

Is there any way to shorten the while loop? Maybe through use of an array or maybe something in the C++ library?

1
2
char choice; 
while (choice != 'a' && choice != 'b'&& choice != 'c' && choice !='d' )
Last edited on
 
while (choice < 'a' || choice > 'd' )  



That's so simple. I cant believe I didn't think of that! Thanks.
Topic archived. No new replies allowed.