Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

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

+2 votes
asked Feb 5, 2020 by Abdullah Al-Salman (140 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, 2020 by Mohammad Danish
Using getchar();
commented Mar 4, 2020 by clickednebula3 (130 points)
edited Mar 23, 2020 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.