changing variable with key input

Apr 25, 2018 at 6:10pm
Hi guys,

I am trying to write a code so when I press a key it changes the value of a variable from 0 to 1. When I press it again, it goes back to 0, and so on. Can anyone help?
Apr 25, 2018 at 7:20pm
When you press enter, you type a character (newline), so maybe try using std::cin.get() in a while loop, and every time you read the newline, change the value?
Last edited on Apr 25, 2018 at 7:22pm
Topic archived. No new replies allowed.