我用c++生成了控制台应用程序后 ,打开就关了,不能暂停,总是纳闷,希望解决掉这个问题。

解决方案 »

  1.   

    getchar(); / system("pause");
      

  2.   


    方法一:
    #include <stdlib.h>
    int main()
    {
    system("pause");
    return 0;
    }方法二:
    #include <stdio.h>
    int main()
    {
    getchar();//须按回车键结束,不是任意键
    return 0;
    }方法三:
    #include <conio.h>
    int main()
    {
    getch();
    return 0;
    }方法四:
    #include <conio.h>
    int main()
    {
    while(!kbhit());
    return 0;
    }
    方法五:
    在reture 0;处设中断。
      

  3.   

    system("pause");
    或者设置个输入,让dos等待输入就行
    只有在vc中调试的时候才会有“按任意键结束”