Executing Code for as long as
Hi :)
I was wondering how I could make a program that executes a piece of code for as long as a key is being touched?
So for example:
Code:
while A is pressed down
cout<<"You are typing A"<<endl;
With the input of A, the output would be "you are typing A".
I can't use
Code:
std::string key;
while(1){
cin >> key;
if (key == "a"){
cout<<"You are typing A"<<endl;
}
since the "cin" would require I press Enter/Return.
When I type text on my computer, the keyboard will output the letter "a" as I type it.
I need something similar to that - which doesn't require Enter/Return.
Thanks in advance :)