I don't know how to explain it, but I will try.
So I write C++ code and I run it with code runner. But the program closes itself. I don't want to use system("PAUSE");
because I need to remove it if I'm in a competition.
So is there another way?
I don't know how to explain it, but I will try.
So I write C++ code and I run it with code runner. But the program closes itself. I don't want to use system("PAUSE");
because I need to remove it if I'm in a competition.
So is there another way?
Ok, I tried something that came to my mind and it works.
"code-runner.executorMap": {
"cpp": "g++ $fullFileName -o $fileNameWithoutExt.exe && start cmd /k $fileNameWithoutExt.exe"
}
I used this in the settings.json
You can use Dev C++ as an alternative IDE. But if you wish to do it in Visual Studio without a system("PAUSE"); you can use cin.get(); or cin.ignore(); as an alternative.
Code:
#include<iostream>
using namespace std;
int main()
{
cout << "Hello World";
cin.ignore();
}
or
#include<iostream>
using namespace std;
int main()
{
cout << "Hello World";
cin.get();
}