格式化 cpp 文件时,发现左大括号是换行的,因此想要修改成不换行的。
二、步骤- 依次点击:文件->首选项->设置,然后输入 C_Cpp: Clang_format_style
- 将默认的 file 改为 {BasedOnStyle: Chromium, IndentWidth: 4}
class Solution
{
public:
vector reversePrint(ListNode *head)
{
vector res;
stack resStack;
if(head == NULL)
{
return res;
}
while(head->next != NULL)
{
resStack.push(head->val);
}
for(int i = 0; i < resStack.size(); i++)
{
res.push_back(resStack.top());
resStack.pop();
}
return res;
}
};
3.2 格式化后
class Solution {
public:
vector reversePrint(ListNode* head) {
vector res;
stack resStack;
if (head == NULL) {
return res;
}
while (head->next != NULL) {
resStack.push(head->val);
}
for (int i = 0; i < resStack.size(); i++) {
res.push_back(resStack.top());
resStack.pop();
}
return res;
}
};



