Competitive Programming setup for VS Code  using C++

Competitive Programming setup for VS Code using C++

ยท

4 min read

Hello ๐Ÿ‘‹ world !

Today Competitive Programming is the new craze among university students and budding software engineers. It provides the best platform to showcase and test your problem-solving skills and programming skills. So many companies have considered it as a way for choosing the candidates with their own contests. So to excel in it, you need programming skills and practice that two are mandatory. But sometimes the rankings can differ in minute time difference. And to gain an edge over these kinds of situations you need a great IDE setup.

I assume that you already have the C++ compiler so this article only explains about the VS Code setup.
If you don't have a proper C++ compiler then mention it in the comments I will help you with them.


Why VS Code ?

VS Code is without any doubt the best IDE a developer can get his hands on. But we should not forget that it is technical a lightweight text editor. But the extensions is all we need. It allows a level of customization that you can not even imagine in other similar IDE or text editors. Customization is the most favorite thing it is also the most popular IDE among developers and that being said the extensions available make it the most productive. I will soon share some cool extensions for your VS Code.


Step 1

First thing is for you to create a folder ๐Ÿ“‚. This is the folder ๐Ÿ“‚ which you will be using for your C / C++ programs.

Step 2

Downloading the necessary extensions. It is better to download the

But if you don't want to it's completely fine.
But you need to have these mandatory extensions


Live snippets

Live snippets are a great way to improve your coding speed when it comes to contests. So I have an amazing one just for you. The file can be awfully long but if you could understand it you will save a great amount of time. If you have trouble understanding the file mention it in the comments I will make a separate article for that.
So head over to this link or to the folder that you have previously cloned to your local system and copy the contents of the boilerplates.cpp file.

Then head over to this page to transform the code into the suitable live snippet syntax.

Then press F1 in your VS Code and select Preferences: Configure user snippets and choose cpp.json and paste the contents you copied with in the { } and save the file. Now to see the magic just create a C++ file within the folder and start typing your trigger word (what you gave in the snippet generator page) and VS Code will show you the list of available snippets with their description. Just select the snippet that we just saved and hit Enter. You will have almost everything you need. Now all that is left for you is to just write the solution for the problem.

Dont't forget to create a input.txt file with in your folder cause you will be giving all the input through this file.

Now create 2 files input.txt and output.txt in the same folder, these folders should be in the root folder. The final thing is to create the view. Just head over to the View>Editor Layout in the menu bar, and I am pretty you will find it. Your VS Code should now look like this.

Visual Studio Code editor layout.png

The input goes to the top right and the output to the bottom right.

Hope this article helped you and sparked your curiosity to learn and practice CP. Do mention your views and opinions in the comments. Do remember that these editor setups can't help you win the contests without your best efforts.

ย