Difference between revisions of "Basic Pascal Tutorial/Chapter 2/Formatting output/ja"
(Created page with "{{Formatting output}} 2C - Formatting Output (author: Tao Yue, state: unchanged) Formatting output is quite easy. For each identifier or literal value on the argument list, ...") |
|||
Line 1: | Line 1: | ||
{{Formatting output}} | {{Formatting output}} | ||
− | 2C - | + | 2C - 出力の書式指定 (著者: Tao Yue, 状態: 原文のまま修正なし) |
− | + | 出力の書式しては非常に簡単である。引数リストの各識別子、あるいは文字値に以下を用いればよい。 | |
<syntaxhighlight> | <syntaxhighlight> | ||
Value : field_width | Value : field_width | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | 出力は指定された整数値の幅で右揃えになる。幅がデータに対して十分な長さがない場合には、幅指定は無視され、そのデータはそのままに表示される(実数値の場合は除く。以下を参照)。 | |
− | + | 以下のようなケースだとしよう。 | |
<syntaxhighlight> | <syntaxhighlight> | ||
write ('Hi':10, 5:4, 5673:2); | write ('Hi':10, 5:4, 5673:2); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | 出力は以下のようになる(すなわち、Hiの前に8個のスペース、その後に3個のスペース)。 | |
Hi 55673 | Hi 55673 | ||
− | + | 実数値に対しては特定のフィールド幅で科学的表記を前述の構文で表現できる。あるいはそれを固定小数点表記に変換することもできる。 | |
<syntaxhighlight> | <syntaxhighlight> | ||
− | Value : | + | Value : フィールド幅 : 小数点以下のフィールド幅 |
</syntaxhighlight> | </syntaxhighlight> | ||
Line 32: | Line 32: | ||
{|style=color-backgroud="white" cellspacing="20" | {|style=color-backgroud="white" cellspacing="20" | ||
− | |[[Output|previous]] | + | |[[Output/ja|previous]] |
− | |[[Contents|contents]] | + | |[[Contents/ja|contents]] |
− | |[[Files|next]] | + | |[[Files/ja|next]] |
|} | |} |
Revision as of 16:23, 5 August 2015
│
български (bg) │
Deutsch (de) │
English (en) │
français (fr) │
日本語 (ja) │
中文(中国大陆) (zh_CN) │
2C - 出力の書式指定 (著者: Tao Yue, 状態: 原文のまま修正なし)
出力の書式しては非常に簡単である。引数リストの各識別子、あるいは文字値に以下を用いればよい。
Value : field_width
出力は指定された整数値の幅で右揃えになる。幅がデータに対して十分な長さがない場合には、幅指定は無視され、そのデータはそのままに表示される(実数値の場合は除く。以下を参照)。
以下のようなケースだとしよう。
write ('Hi':10, 5:4, 5673:2);
出力は以下のようになる(すなわち、Hiの前に8個のスペース、その後に3個のスペース)。
Hi 55673
実数値に対しては特定のフィールド幅で科学的表記を前述の構文で表現できる。あるいはそれを固定小数点表記に変換することもできる。
Value : フィールド幅 : 小数点以下のフィールド幅
The field width is the total field width, including the decimal part. The whole number part is always displayed fully, so if you have not allocated enough space, it will be displayed anyway. However, if the number of decimal digits exceeds the specified decimal field width, the output will be displayed rounded to the specified number of places (though the variable itself is not changed).
write (573549.56792:20:2);
would look like (with 11 spaces in front):
573549.57
previous | contents | next |