c++中实现press any key to continue
时间: 2023-09-09 10:10:12 浏览: 139
在 C 语言中,可以使用 getchar() 函数实现 "press any key to continue" 的效果。该函数会从标准输入流中读取一个字符,直到用户按下任意键为止。可以使用以下代码实现:
```c
#include <stdio.h>
int main() {
printf("Press any key to continue...");
getchar();
return 0;
}
```
该程序会输出 "Press any key to continue...",然后等待用户按下一个键后才会结束。