Live Input Output (Competitive Programming) setup in VS CODE for C/C++ (WINDOWS)
5hfT
Posted on May 22, 2020
How to install and setup vs code for competitive programming with c/c++ for Windows Users
install vs code
- Download vs code : Link
- Install in your pc
Setup environment for c/c++
install mingw : link
In you pc search for system environment
- go to Environment variables
- Go to system varibale and click on path
click edit
select new
-
paste the link where you mingw bin folder . for me it is
C:\MinGW\bin
- find it there
select ok ok for everything
Install git
- download link Link
Then
Open Vs code
Open your coding folder
file->open folder
press
ctrl+~
and the terminal will be opened at the bottom
if in the terminal u find that its cmd or powershell then click on cmd/powershell and select '
set default sell
' and selectgit
- Now click on the delete icon and press
ctrl+~
and its saying your shell is bash!
- Now click on the delete icon and press
if still bash no showing then close vs code and open vs code again
Run a programme for testing :
- create a file hello.cpp
- write code to print hello
-
in terminal use the command
g++ hello.cpp -o test && ./test
If you find
hello
then congratsif saying g++ not found then try to close vs code and then oepn vs code again.
Setup Vs Code
select configure task
select create task.json from template
select other and new task.json file will be created
now copy and paste the my
task(windows).json
{link is here} file into yourtask.json
filedone
More things to do :
Note : You just need to do these things only for the first time of your workspace!
- Split screen in 3 sections
- split the main section in right (right mouse click on the .cpp file and u will get the split options)
- then split the right into down (same as above)
- create a file named
input.txt
- create a file named
output.txt
- open input.txt into the upper right section
- open output.txt into the lower right section
This will be the final look of your vs code
Now create a folder and create your file .cpp inside the folder and give inputs in input.txt and press Ctrl+Shift+b
and your output will be in the output.txt file
Note : Don't keep the cpp file in the base folder. I mean you have to create one or more folders in the base folder (Base folder means where you opened your vs code or you can say vs code wrokspace folder).and the input and output file should be in the base folder.
Folders should be like this or similer :
Not This
Press Ctrl+Shift+b
and your output will be in the output.txt file
Happy coding :3
Posted on May 22, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.