Is there any function except getch() which can pause a program (C++)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is there any function except getch() which can pause a program (C++)?

conio.h doesn't seem to work in codeblocks

12th Sep 2018, 1:57 AM
Atharva Vaidya
Atharva Vaidya - avatar
4 Answers
+ 2
that's because conio.h is extremely outdated. you can use the methods getchar() or getline() to await input
12th Sep 2018, 9:14 AM
hinanawi
hinanawi - avatar
+ 2
also system("pause"); will pause the program until user presses a key
12th Sep 2018, 12:44 PM
Data
Data - avatar
+ 1
_sleep(time); will pause the program for specified time. Replace "time" with the amount of milliseconds you wish the program to be paused. Also MVS complains about this _sleep function, but it works nontheless
12th Sep 2018, 12:43 PM
Data
Data - avatar
+ 1
Thanks!
15th Sep 2018, 1:46 AM
Atharva Vaidya
Atharva Vaidya - avatar