Created
May 8, 2020 04:11
-
-
Save YashKumarVerma/0708e48a901be5b5bcf3ebfe8bb10c80 to your computer and use it in GitHub Desktop.
Snippets for CPP development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cpp": { | |
"prefix": ["cpp"], | |
"body": [ | |
"/**", | |
" *@author: YashKumarVerma", | |
" *@desc: $1", | |
" *@time: $CURRENT_DAY_NAME $CURRENT_DATE-$CURRENT_MONTH_NAME-$CURRENT_YEAR $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND", | |
" **/\n", | |
"#include<iostream>\n", | |
"using namespace std;\n", | |
"int main(){", | |
"\t$2", | |
"\treturn 0;", | |
"}" | |
], | |
"description": "simple c++ file structure" | |
}, | |
"cout": { | |
"prefix": "co", | |
"body": "cout << \"$1\" << endl;\n$0", | |
"description": "cout statement" | |
}, | |
"cin": { | |
"prefix": "ci", | |
"body": "cin >> $1 ;\n$0", | |
"description": "cout statement" | |
}, | |
"/": { | |
"prefix": "/", | |
"body": "/* $1 */$0", | |
"description": "multiline comment in C++" | |
}, | |
"cc": { | |
"prefix": ["cc"], | |
"body": [ | |
"/**", | |
" *@author: YashKumarVerma", | |
" *@desc: $TM_FILENAME_BASE", | |
" *@time: $CURRENT_DAY_NAME $CURRENT_DATE-$CURRENT_MONTH_NAME-$CURRENT_YEAR $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND", | |
" **/\n", | |
"#include<iostream>", | |
"#include<vector>\n", | |
"using namespace std;\n", | |
"int main(){", | |
"\tint tc, items, temp;", | |
"\tvector<int>data;", | |
"\tcin >> tc;\n", | |
"\tfor(int _i=0; _i<tc; _i++){", | |
"\t\tcin >> items;", | |
"\t\tfor(int i=0; i<items; i++){", | |
"\t\t\t$1", | |
"\t\t}\n", | |
"\t\t$2\n", | |
"\t\tif(_i != tc-1){cout << endl;}\n", | |
"\t}\n", | |
"\treturn 0;", | |
"}" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment