How do you do this in C ++? For example, I try to start a program exit if the user presses ESC or "q" or "Q".
I tried looking for it, but I did not find syntax for it in C ++. I know how to do this with if-else, but is it possible with a switch? Of course, I can just make a function and call it from two separate cases, but is there a way to do this only with the combined case statement?
For example, what I'm looking for (of course, doesn't work):
void keyboard( unsigned char key, int x, int y ) { switch( key ) { case ( 27 || 'q' || 'Q' ): exit( 0 ); break; case 'a': ... case 'b': ... } }
c ++ visual-studio-2010
zsero
source share