Hii everyone! Setting up sublime text for competitive coding is easy but not at the very first try.
Today, your that first try will be made simpler and easier by bringing the right things in fron of you. This is specifically done for mac os x.
So let's get started.
1) C/C++
Step -1 : Create and save three files
1) input.in
2) output.in
3) hello.cpp / hello.c file
Step - 2 : Install gcc(GNU Compiler Collection) by running the command below in the terminal.
Install gcc -
If you already have gcc installed, check the version of gcc by
OR
Now to install gtimeout, run the command
Since we will require gtimeout which is a part of coreutils library, we are installing coreutils.
As a next step, create a new build system using the following steps.
Tools->Build System->New Build System
Now copy the following code in the current file
Now, Save the buile fie with any name your want with an extension '.sublime-build'
For example, C++.sublime-build
Now setup the column view,
1) View -> Layout -> Columns: 3
2) View -> Group -> Max Columns: 2
Here's how it will look,
Now you're all set to go!
Write some code in .cpp/.c file, select the build system as C++, the one which you just created and write the input in inp.in file and run the code.
You will see the output in out.in.
Final setup
2) Python
For Python, if you already have created inp.in and out.in for C/C++, you don't need to create them again. And create the files if you have not already created them before.
Now, Create a .py file. For example, sample.py
1.Tools->Build System->New Build System
In the file, paste the code given below,
Now you can save the build file with any name like Python3.sublime-build.
Run the code in sample.py code, write th input in inp.in file and you will see the output in out.in
No comments:
Post a Comment