实现按任意键继续
分类: 代码 | 标签: 代码 | 日期:2009-09-03 | 1 views
隐/显
你可能对这些也感兴趣
老是在用的时候忘记怎么搞,索性记录下来。在c/c++中实现press any key to continue的用法。
这段代码没有平台依赖性。Linux下需要加上编译连接选项-lcurses
头文件部分(header file)
#ifdef _WIN32
#include “conio.h”
#else
#include “curses.h”
#endif
代码部分(source code)
#indef _WIN32
system(“PAUSE”);
#else
#ifdef __cplusplus
std::cout << “press any key to continue”;
#else
printf(“press any key to continue”);
#endif
getch();
#endif
目前还没有人发表评论 ↓发表评论↓

