栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

vs创建C++模板

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

vs创建C++模板

在使用C++做题的时候发现每次都要打一遍模板文件,或者复制,这样的操作有点烦。vs中有一个自定义模板可以帮我们解决这个问题

1. 点击左下角齿轮,选择user snippets

输入cpp.json,回车 

复制以下代码

{
	// Place your snippets for cpp here. Each snippet is defined under a snippet name and has a prefix, body and 
	// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
	// same ids are connected.
	// Example:
	// "Print to console": {
	// 	"prefix": "log",
	// 	"body": [
	// 		"console.log('$1');",
	// 		"$2"
	// 	],
	// 	"description": "Log output to console"
	// }
	"C++ template": {
		"prefix": "cpp",
		"body": [
			"#include ",
			"#include ",
			"using namespace std;",
			"int main(){",
			"",
			"treturn 0;",
			"}"
		],
		"description": "C++模板"
	}
}

prefix表示前缀,我这里用的是cpp来带出模板文件,body是带出的内容,description是描述,可以自由修改,"t"是加一个tab,控制缩进 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/692410.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号