switch triggered on key press

Hey guys,
I was working on a program to simulate a finite representation of infinity and had this thought.

Is it possible to have a switch statement trigger on key press (specifically left and right keys)?
If so, how might such be set up?
Or would there be a better way to trigger code on key press?

I'm mostly just curious but thank you for any help.
It's a real PITA to do this with the IOStream library but if you're using something like SDL, SFML or WinAPI already then it becomes much easier.
Topic archived. No new replies allowed.