Difference between revisions of "MC-Basic:PRINTUSING/zh-hans"
(chi) |
(chi) |
||
| Line 1: | Line 1: | ||
| − | + | ||
|缩写= | |缩写= | ||
PrintU | PrintU | ||
| Line 69: | Line 69: | ||
?????? PrintU “Keep numbers to a fixed length with PrintUsing: ######” ; 100 | ?????? PrintU “Keep numbers to a fixed length with PrintUsing: ######” ; 100 | ||
| − | | | + | |可查看= |
* [[MC-Basic:CLOSE|CLOSE]] | * [[MC-Basic:CLOSE|CLOSE]] | ||
* [[MC-Basic:INPUT$|INPUT$]] | * [[MC-Basic:INPUT$|INPUT$]] | ||
| Line 76: | Line 76: | ||
* [[MC-Basic:PRINT HASH|PRINT HASH]] | * [[MC-Basic:PRINT HASH|PRINT HASH]] | ||
* [[MC-Basic:PRINTUSING hash-sign|PRINTUSING hash-sign]] | * [[MC-Basic:PRINTUSING hash-sign|PRINTUSING hash-sign]] | ||
| − | |||
| − | |||
| − | |||
Revision as of 06:05, 10 April 2017
|缩写= PrintU
|格式= PrintUsing “<format_string>”;[<expression>];{[<expression>]}*
|使用版本= 所有版本
|描述=
以指定的字符串格式打印格式化的数字变量。该格式化字符串可以包含字面意思的文本,也可以打印数字表达式。一下字符可以用来格式化数字表达式:
?????? #??? ?????? 数字位置
.???? ?????? 小数点
?????? +??? ?????? 打印表达式符号
^^^^?? 打印指数格式
表达式只允许打印包含一个格式化字符串(包括文本与格式化字符)的表达式。
|类型=
<格式化字符串>: String
<表达式>: Long, Double or String
|范围=
|单位=
|默认=
|使用范围=
Configuration, Task or Terminal
|限制=
只能显示小数点后15位有效数字。声明:
?????? printu “#.################”;My_Var
格式化字符串只能打印15位数字,而不是16位。小数点前数字只能打印16位。声明:
?????? printu “#.#”;1e15
被打印为:
?????? 100000000000000.0
当:
?????? printu “#.#”;1e16
被打印为
?????? 1.0e16
|例子=
利用“#”与好小数点,指定最小显示字符个数
?????? B = 33.344
?????? PrintU “B is ##.##”;B???? ‘prints B IS 33.34
?????? PrintU “B is ##.####”;B???? ‘prints B IS 33.3440
PrintU “B is ##.##^^^^”;B???? ‘prints B IS 3.33e+01 (您必须使用4个“^”符号来实现该功能)
另一个例子:
?????? PrintU "The number is #;j1,j2
?????? à The number is 1, The number is 2
指定打印的位数,实现表格化打印,这样不会因为数字的数值不同而导致位数不同:
?????? PrintU “Keep numbers to a fixed length with PrintUsing: ######” ; 100
|可查看=