Skip to content

Latest commit

 

History

History
111 lines (91 loc) · 5.19 KB

Readme.md

File metadata and controls

111 lines (91 loc) · 5.19 KB

Cpp-Snip

Welcome to the Cpp-Snip-CP Snippets extension! This extension provides a collection of helpful snippets for quickly typing C++ code during competitive programming contests.

Installation

To install this extension, follow these steps:

  1. Open Visual Studio Code
  2. Open the Extensions view by pressing Ctrl+Shift+X (Windows, Linux) or Cmd+Shift+X (macOS)
  3. Search for "Cpp-Snip-CP"
  4. Click the Install button
  5. Once the extension is installed, you're ready to start using it!

Another way to install it is, open your terminal and paste this command and hit enter:

code --install-extension Shariar-Hasan.cpp-snip-cp

Usage

This extension provides a number of helpful snippets for quickly typing C++ code during competitive programming contests. Here are all off them:

Variales:

  • ll - Declares a variable of type long long.
  • ull - Declares an unsigned variable of type long long.
  • dbl - Declares an unsigned variable of type double.
  • vi - Declares a vector of type int.
  • vb - Declares a vector of type bool.
  • vl - Declares a vector of type long long.
  • vs - Declares a vector of type string.
  • si - Declares a set of type int.
  • sl - Declares a set of type long long int.
  • map - Declares a map.
  • umap - Declares a unordered_map.
  • pii - Declares a pair of type int and int.
  • pll - Declares a pair of type long long and long long.
  • vii - Declares a vector of pairs of type int and int.
  • vis - Declares a vector of pairs of type int and string.
  • vsi - Declares a vector of pairs of type string and int.
  • vvi - Declares a 2D vector of type int.
  • vll - Declares a vector of pairs of type long long and long long.
  • vit - Declares an iterator for a vector of type int.
  • sit - Declares an iterator for a set of type int.
  • mit - Declares an iterator for a map.
  • umit - Declares an iterator for an unordered_map.

Inputs & Outputs

  • nln - Print a new line anywhere
  • printall - Print all the element in any iterables
  • inptest - Custom test case inputing
  • fastio - To stop sync with stdio, make code faster
  • fopen - Input and output txt file load
  • YESNO - Short Cut for IF ELSE Statement
  • yes - Print YES with newline
  • no - Print No with newline
  • print - Print an item
  • input - Take input on an item
  • inputall - Take input on multiple items
  • debug - Use to debug code

Built In Functions

  • pb - Inserts an element at the end of a container.
  • pob - Removes the last element from a container.
  • pf - Inserts an element at the beginning of a container.
  • mp - Creates a pair object with two values.
  • maxall - Finds the maximum element in a container.
  • minall - Finds the minimum element in a container.
  • memset - Sets a block of memory to a particular value.
  • sort - Sorts a container in ascending order.
  • revsort - Sorts a container for array in descending order.
  • memset - Fill 0 | -1 to any array
  • count - Count the number of appearance in a certain iterable
  • max - Finds the maximum of two values.
  • min - Finds the minimum of two values.
  • IF - If Statement in cpp.
  • IFELSE - If else Statement in cpp.
  • IFELSEIF - Else if Statement in cpp.

Loops

  • foriinc - Make a for loop with i from 0 to n-1
  • fori1inc - Make a for loop with i from 1 to n
  • foridec - Make a for loop with i from n-1 to 0
  • forjinc - Make a for loop with j from 0 to n-1
  • forj1inc - Make a for loop with j from 1 to n
  • forjdec - Make a for loop with j from n-1 to 0

Others

  • vall - Complete from beginning to ending element of a STL
  • aall - Complete from beginning to ending element of an array

CPP Boilarplate

  • cppcontest - A complete boilarplate for the contest

To use a snippet, simply start typing the snippet name and select the appropriate suggestion from the IntelliSense menu. Alternatively, you can use the keyboard shortcut associated with the snippet (which is displayed next to the snippet name in the IntelliSense menu).

In addition to these snippets, this extension also provides a number of other features that can help you during competitive programming contests:

  • Auto-completion of common C++ keywords and syntax
  • Make your typing faster
  • Syntax highlighting for C++ code

To access these features, simply open a C++ file and start typing. You'll see suggestions for common C++ keywords and syntax, and you can use the extension's custom templates to quickly generate code for different programming challenges.

Contributing

If you'd like to contribute to this extension, you can do so by submitting a pull request on the extension's GitHub repository: Cpp-Snip

Feedback and Support

If you have any feedback or issues with this extension, please feel free to submit an issue on the extension's GitHub repository: Submit Issues

You can also find additional resources for learning C++ and competitive programming on the extension's website: Official Website