Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to pause like system("pause")?

I've been looking for this on the internet for soooooo long. Is there a way you can press any key and it immediately stops the pause and carries on with executing the code but it doesn't show up the key you pressed on the screen (like system("pause"))?

People said cin.get() and stuff like that, however, if I use that, I have to press any key AND it displays on the screen and you have to press enter after that.

like image 640
SomeRandomGuy Avatar asked Mar 21 '23 04:03

SomeRandomGuy


1 Answers

Since you're referencing system("pause") I guess you're using Windows, then you can use _getch to wait for any key.

like image 59
Some programmer dude Avatar answered Apr 02 '23 17:04

Some programmer dude