If you are looking for a setup like the one below, the following instructions might help you configure this on your workstation.
In case you are learning DSA, you should definitely check out our free A2Z DSA Course with videos and blogs.

Follow the instructions to set up for C++:
- The first step is to download VS Code. After downloading VS Code, you also need to setup mingW, which will be used in compiling and linking the C++ code. If your system already has it, feel free to skip this step.
- After you finish setting up the configuration, we need to create a folder to store our files. Create a cpp file containing your code, an input.txt file, which is what you will give, and an output.txt file, where the output of your code will be printed.
-
Now, download the C/C++ Extension pack from Microsoft.
-
If you see, you will have a similar view with all three files next to each other. To create a similar view as the result
– go to view,
– go to editor layout,
– click on split left,
This will separate the main cpp file to the left from the input and output files.
To split input and output in two sections, then have your cursor on input.txt file and then follow the same steps; - Since we have created and aligned the input and output files, we have to run these files. To make sure our input gives an output, we will have to configure it. Go to Terminal, select Configure Tasks, choose Create tasks.json file from the template, and then select others.
Terminal -> Configure Tasks -> Create tasks.json file from template -> others
-
After selecting others, you will see a new .vscode file and, in that, a tasks.json file, clear the current text in the json file and paste this.
For Mac Users
{ "version": "2.0.0", "tasks": [ { "label": "compile", "type": "shell", "command": "g++", "args": [ "-std=c++17", "-o", "${fileBasenameNoExtension}", "${file}" ], "group": { "kind": "build", "isDefault": false } }, { "label": "compile and run", "type": "shell", "command": "g++ -std=c++17 -o ${fileBasenameNoExtension} ${file} && ./${fileBasenameNoExtension} < input.txt > output.txt", "group": { "kind": "build", "isDefault": true } } ] }
For Windows Users
Note: It will not work if your default terminal is Powershell. Make it "cmd" then it will work. To change default terminal : Hit clt+shift+p->write:default terminal->change it to cmd. { "version": "2.0.0", "tasks": [ { "label": "Compile and run", "type": "shell", "command": "", "args": [ "copy", "\"${file}\"", "${workspaceFolder}\\jspwTest.cpp", "&&", "g++", "jspwTest.cpp", "-o", "jspwTest", "&&", "jspwTest", "<", "input.txt", ">", "output.txt", "&&", "del", "jspwTest.exe", "&&", "del", "jspwTest.cpp" ], "presentation": { "reveal": "never" }, "group": { "kind": "build", "isDefault": true, }, "problemMatcher": { "owner": "cpp", "fileLocation": [ "relative", "${workspaceRoot}" ], "pattern": { "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 } } } ] }
If you are using some other OS, you can use ChatGPT to get the equivalent command. - Post writing a program in cpp press (cmd+shift+B) for Mac and (ctrl+shift+B) for Windows to run the code and get your the desired output. In case you are facing some issue, we recommend you to use Bard or ChatGPT to get your errors resolved.