Skip to content

Latest commit

 

History

History
143 lines (86 loc) · 4.59 KB

readme(windows).md

File metadata and controls

143 lines (86 loc) · 4.59 KB

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

search system enbironment

  • 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 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 select git

    • Now click on the delete icon and press ctrl+~ and its saying your shell is bash!
  • 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 congrats

  • if saying g++ not found then try to close vs code and then oepn vs code again.

Setup vs code

  • 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 your task.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

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

In the Repository i have also added config files for other Programming Languages too :

Note : Make sure your mouse corsor is clicked or focused on the cpp file editor while you are running your code.

2. VS CODE Snippet

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 !

Usage :

  • Creating a cpp file if you type inc and press Tab in your keyboard the snippet will load as i have set prefix as inc in my json file . (You can edit as your own !)

  • This will make programming easy and fast .

  • Snippets for :

Happy coding :3