How can I detect if a button is pressed in C++?

+1 vote
asked Feb 5 by Abdullah Al-Salman (130 points)

I am creating a little game using C++, I want it to go to the next frame automatically and ignores waiting for input, then, if a key is pressed it inputs it to the variable and repeat (to the next frame)

my current game is https://www.onlinegdb.com/B1oTXc5-8 but you have to press enter key evry time you want to move, and it also doesn't update until you move or type any gibberish.

1 Answer

–1 vote
answered Feb 28 by Mohammad Danish
Using getchar();
commented Mar 4 by clickednebula3 (130 points)
edited Mar 23 by clickednebula3
getchar requires me to use the enter key as well
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...