简体   繁体   中英

Visual Studio C++ -> Local Windows Debugger

While running a program in Visual Studio C++ editor, when i click on Local Windows Debugger, the command prompt window opens up, where i am asked to input data (depending on my program). The problem is the window doesn't stay very long after the output is shown.

What do i need to do to keep the window up for a longer time, or at least until i close the window myself?

I tried for over half hour to check various options and see if there is anything that can be done to prolong the duration.

Thanks and regards, Nikhil Kenvetil

尝试使用以下方法之一在main()函数的末尾添加一些代码:

  1. getchar();
  2. char ch; cin>>ch;

Try this:

#include <iostream>
#include "conio.h"

int main()
{
    std::cout << "Hello World\n";
    getch();    
    return 0;
}

您可以尝试使用system(“ PAUSE”);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM