Live Input Output (Competitive Programming) setup in VS CODE for C/C++ (WINDOWS)

mh_shifat

5hfT

Posted on May 22, 2020

Live Input Output (Competitive Programming) setup in VS CODE for C/C++ (WINDOWS)

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

Environment variables

  • Go to system varibale and click on path

system varibale

  • 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

terminal

  • 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)
    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 Screen
    • 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

Final Look

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 :

VS CODE Folders

Not This

Press Ctrl+Shift+b and your output will be in the output.txt file

Happy coding :3

💖 💪 🙅 🚩
mh_shifat
5hfT

Posted on May 22, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related