VC中 Press any key to continue怎么实现?VC中程序运行到最后会有Press any key to continue,而我现在使用
VC中 Press any key to continue怎么实现? VC中程序运行到最后会有Press any key to continue,而我现在使用的slickedit调用DOS界面后直接就把界面关了,一闪而过,没有Press any key to continue,能不能让它像VC一样自动加上Press any key to continue?
[解决办法]
C/C++ code
int main(){ int s = 123456; while(s>0) printf("%d", s%10), s/=10; system("pause");//就是这一句“Press any key to continue” return 0;} [解决办法] system("pause"); [解决办法] 加上这句试试,system("pause"); [解决办法]
[解决办法]
[解决办法] 执行系统命令,相当于cmd中的pause命令一样。 [解决办法] system("PAUSE");可以实现. 自己写也可以很容易地实现: fprintf("Press any key to continue..."); getchar(); [解决办法] 刚开始从vc6.0转用vs2005时也很困惑,编个hello,world的程序都实现不了,首先创建一个win32 console application的工程,然后得选择空白项目(vs2005帮你默认的不是空白的),终于可以写程序了,发现cin,cout不能用,得using namespace::std;,执行发现DOS界面一闪而过,不像vc6.0下的,得专门写system("pause"),或者写getchar()等。用的多了,也不觉得不习惯了,而且vs2005的编译器标准化程度比较高,呵呵。