Button press / Keydown event?

Hey this should be pretty simple I want my console app to react when a key is pressed , for example if its just running a loop of text I want to end the loop when this key is pressed.

1
2
3
4
5
6
for (int i = 0; i < 55550 ; i++){
	std::cout << "Random Text \n";
        //if (f12 is pressed){
              break;
        }
}


Something like that but obviously with syntax and I am guessing this might not even go inside the loop , but I want the break to be on keydown as something like cin.get() = "f12" means I would have to press return after pressing the key which I dont want
Last edited on
Topic archived. No new replies allowed.