- Download vs code : Link
- Install in your pc
-
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
- download link Link
Then
-
Open Vs code
-
Open your coding folder
file->open folder
-
press
ctrl+~
and the terminal will be opened below (At the bottom of the vs code)
-
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
-
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 congrats -
if saying g++ not found then try to close vs code and then oepn vs code again.
- Clik on terminal (At the top bar)
- 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
file - done
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
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.
-
task.json files for :
-
Python :
-
Java :
-
Dart :
-
Note : Make sure your mouse corsor is clicked or focused on the cpp file editor while you are running your code.
This one is made for my personal usage ,you can add functions as you wish and edit my name and doc
- Select User Snippets under File (at Left top bar) > Preferences (Code > Preferences on macOS), and then select cpp.json
- copy or replace the cpp.json file {Link} and save !