在使用vs時,怎樣自動生成main函式的代碼塊呢?
其實很簡單,先在桌面上新建一個文本檔案,接下來把我下面寫的代碼粘貼到檔案中保存,
代碼:
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>main</Title>
<Shortcut>main</Shortcut>
<Description>main 函式自動生成</Description>
<Author>Microsoft Corporation</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Code Language="cpp"><![CDATA[#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int main()
{
system("pause");
return 0;
}
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
將檔案的名改為ma.snippet

然后找到自己vs的安裝目錄依次進入
Common7->IDE->VC->Snippets->2052->
VisualC++
將自己桌面上改好的檔案拖進檔案里就可以了
再進入自己的Vs中建一個C++的專案,輸入ma然后點擊Tab就會自動生成代碼塊,如下:
是不是很方便呢!
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/278500.html
標籤:其他
上一篇:關于ubuntu花屏問題解決方法
