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:
With the input of A, the output would be "you are typing A".Code:while A is pressed down cout<<"You are typing A"<<endl;
I can't use
since the "cin" would require I press Enter/Return.Code:std::string key; while(1){ cin >> key; if (key == "a"){ cout<<"You are typing A"<<endl; }
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