【发布时间】:2014-04-10 08:44:46
【问题描述】:
如何格式化文本“对齐”,使其在给定宽度下左右对齐?
int main()
{
printJustified("A long text with many words. "
"A long text with many words. "
"A long text with many words. "
"A long text with many words. "
"A long text with many words.");
}
预期输出:
A long text with many words. A long text with
many words. A long text with many words. A
long text with many words.
【问题讨论】:
-
@JoachimPileborg 他似乎也想要辩解。 (不是固定宽度的字体是个好主意,否则也不是微不足道的。)
标签: c++ stream formatting string-formatting