1
0

cpp.json 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. {
  2. // C:\Users\vip\AppData\Roaming\Code\User\snippets
  3. // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
  4. "regex模版": { "prefix": "regex",
  5. "body": [
  6. "#include <bits/stdc++.h>\nusing namespace std;\nint main() {\n string s(\"A1234B5678C999 A1234B5678C999\");"
  7. "\tsmatch m; regex e(\"\\\\\\d+\");\n\n while (regex_search(s, m, e)) {\n cout << m.str() << endl;"
  8. "\t\ts = m.suffix().str();\n }\n}"
  9. ], "description": "regex模版" },
  10. "fopen示例模版": { "prefix": "fopen",
  11. "body": [
  12. "#include <stdio.h>\nint main() {\n FILE *pFile;\n pFile = fopen(\"myfile.txt\", \"w\");\n if (pFile != NULL) {",
  13. " $1fputs(\"fopen example\", pFile);\n fclose(pFile);\n }\n return 0;\n}"
  14. ], "description": "fopen示例模版" },
  15. "printf模版": { "prefix": "prf",
  16. "body": [
  17. "printf(\"%d\", $1);"
  18. ], "description": "printf模版" },
  19. "C语言模版": { "prefix": "cc",
  20. "body": [
  21. "#include <stdio.h>\n#include <stdlib.h>\n",
  22. "int main()",
  23. "{",
  24. "\t$1printf(\"Hello world!\");",
  25. "\treturn 0;",
  26. "}"
  27. ], "description": "C语言模版" },
  28. "CPP语言模版": { "prefix": "cpp",
  29. "body": [
  30. "#include <iostream>\n#include <string>\n#include <algorithm>\n",
  31. "using namespace std;",
  32. "int main(int argc, char* argv[])",
  33. "{",
  34. "\t$1cout << \"Hello world!\" << endl;",
  35. "\treturn 0;",
  36. "}" ], "description": "CPP语言模版" }
  37. }