-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathcpp.json
90 lines (89 loc) · 1.86 KB
/
cpp.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{
"Default cpp formate": {
"prefix": [
"include",
"default"
],
"body": [
"/*\n\nAuthor : Mehedi Hasan Shifat\n",
"github:https://github.com/jspw\n",
"linkedin : https://www.linkedin.com/in/mehedi-hasan-shifat-2b10a4172/\n",
"Stackoverflow : https://stackoverflow.com/story/jspw \n\n",
"*/\n\n",
"#include <iostream>",
"#include <algorithm>",
"#include <string>",
"#include <vector>",
"#include <cstdlib>",
"#include <bitset>",
"#include <set>",
"#include <map>",
"#include <iterator>",
"\n",
"using namespace std;",
"#define ll long long",
"#define ull unsigned long long",
"\n",
"//Sort array in discending order (n to 1)",
"bool decSort(ll a,ll b){",
" return a>b;",
"}",
"\n",
"//find the maximum element of a array",
"ll max_of_array(ll a[],ll n){",
" ll mx=a[0];",
" for(ll i=0;i<n;i++){",
" if(a[i]>mx) mx = a[i];",
" }",
" return mx;",
"}",
"\n",
"//find the minimum element of a array",
"ll min_of_array(ll a[],ll n){",
" ll mn=a[0];",
" for(ll i=0;i<n;i++){",
" if(a[i]<mn) mn = a[i];",
" }",
" return mn;",
"}",
"\n",
"bool isPrime(ll n){",
" if(n==1) return false;",
" if(n==2) return true;",
" for(ll i=2;i*i<=n;i++){",
" if(n%i==0)return false;",
" }",
" return true;",
"}\n",
"ll gcd(ll a, ll b)",
"{",
" if (b == 0)",
" return a;",
" return gcd(b, a % b);",
"}\n",
"ll lcm(ll a, ll b)",
"{",
" return (a * b) / gcd(a, b);",
"}\n",
"\n",
"int main(){\n",
" ios_base::sync_with_stdio(false);",
" cin.tie(NULL);",
"\n $1",
"\n\n",
" return 0;",
"}\n",
""
],
"description": "This is a c++ snippet"
},
"for loop": {
"prefix": "forl",
"body": [
"for($1 $2 = $3 ; $2 < $4 ; $2++)",
"{"," ${0:/* code */}",
"}"
],
"description": "For Loop"
}
}