We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 9 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(9)
GNU Indent 应该可以帮助您完成大部分工作
GNU Indent should get you most of the way there
在 Visual Studio 中:编辑/高级/格式化文档
应用于文档的格式将与以下设置匹配:工具/选项/文本编辑器/C/C++
Visual Studio 可能不支持您想要应用于文档的所有格式选项,其中在这种情况下,您需要一个单独的工具(例如 Paul Betts 建议的工具)来按照您想要的方式进行格式化。
In Visual Studio: Edit / Advanced / Format Document
The format applied to the document will match the settings in: Tools / Options / Text Editor / C/C++
Visual Studio might not support all the formatting options you want applied to your document, in which case you'll need a separate tool (such as Paul Betts is suggesting) to format the way you want.
Astyle 是比较流行的工具之一。
编辑:我不知道为什么我第一次发布这篇文章时没有考虑到这一点,但你也可以使用 Vim。
=
命令将根据您的indentexpr
和cinoptions
重新格式化您的代码。Astyle is one of the more popular tools.
Edit: I don't know why I didn't think about it when I first posted this, but you can also use Vim. The
=
command will reformat your code according to yourindentexpr
andcinoptions
.我投票给 Uncrustify。
否则:最佳 C++ 代码格式化程序/美化程序
I vote for Uncrustify.
Otherwise: Best C++ Code Formatter/Beautifier
GC Great Code 对我来说是一种老习惯。它是相当可配置的。
http://sourceforge.net/projects/gcgreatcode/
GC Great Code has been an old standby for me. It's quite configurable.
http://sourceforge.net/projects/gcgreatcode/
Visual Studio 可以。大多数 IDE 都可以。
Visual Studio can. And most IDEs can.
我过去也用过 AStyle。我使用这个 GUI 来使它更容易一些(我想——已经有一段时间了):Windows 的艺术风格:http://jimp03.zxq.net/
I have also used AStyle in the past. I used this GUI for it to make it a bit easier (I think--it's been a while): Artistic Style for Windows: http://jimp03.zxq.net/
Eclipse/CDT 可以很好地缩进你的代码......
PS我正在我的
Eclipse/CDT can indent your code very well...
P.S. I am writing something about that in my Book Post comment if you have some direct questions. :-)
使用 AStyle (内置于代码块中)
希望有帮助。
use AStyle ( inbuilt in codeblocks )
Hope it helps.