Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Code Snippet CppNew to Visual Studio Code? Get it now.
Code Snippet Cpp

Code Snippet Cpp

nath2006

|
3 installs
| (1) | Free
Code Snippet For Starting Project CPP
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Code Snippet CPP

Features

This extension provides snippets for:

  • Fast Input Output
  • Competitive Programming Template
  • Vector
  • Pair
  • Loop
  • Debug Macro
  • Typedef
  • Sorting
  • Binary Search
  • Graph
  • BFS
  • DFS
  • Dijkstra
  • Segment Tree

How To Use

  1. Install the extension
  2. Open a .cpp file
  3. Type the snippet prefix
  4. Press:
Ctrl + Space

or press:

Tab

Snippet List

1. Basic C++ Template

Prefix

cppstartbasic

Function

Create a basic C++ program template.

Output

#include <iostream>
using namespace std;

int main() {

    return 0;
}

2. Fast IO

Prefix

cppfastio

Function

Enable fast input output for faster execution when reading large data.

Output

ios::sync_with_stdio(false);
cin.tie(nullptr);

3. Competitive Programming Template

Prefix

cppcp

Function

Create a complete Competitive Programming template with:

  • typedef
  • macro
  • fast io

4. Vector

Prefix

cppvector

Function

Create a C++ vector.

Output

vector<int> v;

5. Pair

Prefix

cpppair

Function

Create a pair.

Output

pair<int, int> p;

6. For Loop

Prefix

cppfor

Function

Create a for loop.

Output

for (int i = 0; i < n; i++) {

}

7. Reverse For Loop

Prefix

cpprfor

Function

Reverse loop.


8. While Loop

Prefix

cppwhile

Function

Create a while loop.


9. Debug Macro

Prefix

cppdebug

Function

Display debug variables quickly.

Output

#define debug(x) cout << #x << " = " << x << endl;

10. Typedef

Prefix

cpptypedef

Function

Shortcut for common Competitive Programming data types.

Output

using ll = long long;
using pii = pair<int, int>;

11. Sorting

Prefix

cppsort

Function

Ascending sort.

Output

sort(v.begin(), v.end());

12. Binary Search

Prefix

cppbinary

Function

Binary search template.


13. Graph

Prefix

cppgraph

Function

Graph adjacency list template.


14. BFS

Prefix

cppbfs

Function

Breadth First Search template.


15. DFS

Prefix

cppdfs

Function

Recursive Depth First Search template.


16. Dijkstra

Prefix

cppdijkstra

Function

Dijkstra shortest path template.


17. Segment Tree

Prefix

cppsegtree

Function

Segment Tree template for:

  • range query
  • point update

Requirements

No additional configuration required.


Known Issues

No known issues yet.


Release Notes

1.0.0

  • Initial Release
  • Added Competitive Programming snippets
  • Added Graph snippets
  • Added Segment Tree snippet

How To Test The Extension

  1. Press F5
  2. Open a .cpp file
  3. Type a snippet
  4. Press Ctrl + Space

Example:

cppcp

Marketplace Keywords

  • cpp
  • c++
  • competitive programming
  • snippets
  • algorithm
  • data structure

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft