Basic Pascal Tutorial/Chapter 2/Formatting output/zh CN
Deutsch · English · Français · Български · 中文(中国) · 日本語
2C - 格式化输出 (原作者: Tao Yue, 状态: 未更改)
格式化输出很易用,如下:
??? : ????????????字段长度指,显示的数据右对齐后占用的宽度。如果宽度不足以显示全部数据,那么指定的字段长度将被忽略(看下面示例)。
如下语句:
write ('Hi':10, 5:4, 5673:2);输出将是(Hi前面有8个空格,后面有3个。)
Hi 55673你可以设置字段长度,以科学计数法形式显示实数。也可以指定小数位数:
??? : ???????????? : ?????????字段长度是总占用宽度,包括小数部分。如果宽度无法显示全部数值,整数部分将会被显示出来;如果小数位超出设定的位数,将被四舍五入。
write (573549.56792:20:2);会是什么样子(有11个空格在前面)?
573549.57| 上一页 | 目录 | 下一页 |
From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 2/Formatting output/zh CN", as it stood on 2022-08-20 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.