Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 2/Formatting output/zh CN: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
112C - 格式化输出 (原作者: Tao Yue, 状态: 未更改)
22
33格式化输出很易用,如下:
44
55``` pascal
66值 : 字段长度
77```
88
99字段长度指,显示的数据右对齐后占用的宽度。如果宽度不足以显示全部数据,那么指定的字段长度将被忽略(看下面示例)。
1010
1111如下语句:
1212
1313``` pascal
1414write ('Hi':10, 5:4, 5673:2);
1515```
1616
1717输出将是(Hi前面有8个空格,后面有3个。)
1818
19-`        Hi   55673`
19+```
20+ Hi 55673
21+```
2022
2123你可以设置字段长度,以科学计数法形式显示实数。也可以指定小数位数:
2224
2325``` pascal
2426值 : 字段长度 : 小数位
2527```
2628
2729字段长度是总占用宽度,包括小数部分。如果宽度无法显示全部数值,整数部分将会被显示出来;如果小数位超出设定的位数,将被四舍五入。
2830
2931``` pascal
3032write (573549.56792:20:2);
3133```
3234
3335会是什么样子(有11个空格在前面)?
3436
35-`           573549.57`
37+```
38+ 573549.57
39+```
3640
3741| | | |
3842|----|----|----|
3943| [[Basic Pascal Tutorial/Chapter 2/Output/zh CN|上一页]] | [[Basic Pascal Tutorial/Contents/zh CN|目录]] | [[Basic Pascal Tutorial/Chapter 2/Files/zh CN|下一页]] |
4044
4145---
4246*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](/wiki-contact).*

Back to history