how to run a c++ program in visual studio code code example
Example 1: how to run c program from visual studio terminal
Fire up the terminal from VS code
Use the command "gcc filename.c" to compile the program
Use the command ".\a.exe" to run the program from the terminal
P.S. Remove "" before exceuting
Example 2: how to run cpp using gcc vscode
{
"version": "0.1.0",
"command": "make",
"isShellCommand": true,
"tasks": [
{
"taskName": "Makefile",
"isBuildCommand": true,
"showOutput": "always",
"args": ["all"],
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
]
}