It seems that I can't find any solution to this problem, so I'm asking you. C doesn't support iostream and Console.Readkey unless i did something wrong, so please help!
Asked
Active
Viewed 187 times
0
-
Why would you like to do this? The wast majority of console programs _shall_ exit without an additional user input. And never ever insist of keyboard input. – the busybee May 07 '22 at 09:35
3 Answers
2
C
getc(stdin);
C++
std::cin.get();
Worst Example Listed on Many Websites
system("pause"); //never use this

Darth-CodeX
- 2,166
- 1
- 6
- 23
0
You can use getchar()
or getc(stdin)
to read a character. The console is line buffered by default (at least on Linux) so it means it will wait for enter
.

Allan Wind
- 23,068
- 5
- 28
- 38
0
import this at the top of your code:
#include <windows.h>
then you can use:
sleep()
in the brackets you can write for how many seconds do you want your program to pause!
Hope this helps (although Im 3 months late)

Ghazi Mohammed
- 21
- 2
-
1Windows `Sleep`s for milliseconds and Unix `sleep`s for seconds. So your late answer is not correct. – Lundin Aug 19 '22 at 13:55