【发布时间】:2021-11-19 06:07:29
【问题描述】:
我在尝试使用 C 编程根据第三列标题对齐最后一列数字时遇到问题。我想将一列的宽度设置为 15 个字符。任何想法将不胜感激。
printf("%-15s ", "Fahrenheit Celsius Kelvin \n");
printf("---------------------------------------------\n");
printf("%-15d""%.2f %-.2f \n", fahrenheit, celsius, kelvin);
【问题讨论】:
-
这能回答你的问题吗? Smart way to format tables on stdout in C
标签: c formatting printf