0

I am looking to compete in the Google KickStart programming competition. I am using C++ in Visual Studio. (not visual studio code) Input parameters are given here as Console arguments, where they can be read with std::cin.

I want to paste the test input parameters into a text file and have the IDE pass them to the program as console arguments (held in the cin buffer). I have done this as defined here

But with this method the command line window will close immediately after the program finishes instead of asking for any key to be pressed. I have tried waiting for dummy input but this does not fix the closing error

pm100
  • 48,078
  • 23
  • 82
  • 145
Reschivon
  • 37
  • 1
  • 7

2 Answers2

0

You may easily implement your own wait "Press enter to continue..." at the end of your routine for testing.

int main(int argc, char** argv)
{
...
    int _tmp;
    std::cout << "Press enter to continue..." << std::endl;
    std::cin >> _tmp;
    return 0;
}
0

Probably your linker settings are incorrect. As far as I'm concerned you should set up SubSystem to Console (/SUBSYSTEM:CONSOLE).(Properties -> Linker -> System -> SubSystem)

Jeaninez - MSFT
  • 3,210
  • 1
  • 5
  • 20