Difference between revisions of "Basic Pascal Tutorial/Chapter 1/Programming Assignment/ja"
(Created page with "{{Programming_Assignment}} 1H - Programming Assignment (author: Tao Yue, state: unchanged) Now you know how to use variables and change their value. Ready for your first pro...") |
|||
Line 1: | Line 1: | ||
{{Programming_Assignment}} | {{Programming_Assignment}} | ||
− | 1H - | + | 1H - 練習問題 (著者: Tao Yue, 状態: 原文のまま修正なし) |
− | + | さて、どう変数を使い、その値を変えるかを学んだ。最初のプログラミング課題をこなす準備はできただろうか? | |
− | + | しかし、ひとつ小さな問題がある。データをディスプレイにどう表示させるかを学んではいないということである。すべての情報がメモリーに保存されていてディスプレイに表示されていないとしたら、プログラムが動いたのかどうかを、どう知ることができるだろうか、それは無理である。 | |
− | + | そこで、プログラミングを始めるために後のレッスンからの断片をここに示した。データを表示するためには、以下を使えばよい。 | |
<syntaxhighlight> | <syntaxhighlight> | ||
writeln (argument_list); | writeln (argument_list); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | 引数リストはコンマで区切られた文字列か変数からなる。以下は例である。 | |
<syntaxhighlight> | <syntaxhighlight> | ||
writeln ('Sum = ', sum); | writeln ('Sum = ', sum); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | 1章の練習問題は以下である。 | |
Find the sum and average of five integers. The sum should be an integer, and the average should be real. The five numbers are: 45, 7, 68, 2, and 34. | Find the sum and average of five integers. The sum should be an integer, and the average should be real. The five numbers are: 45, 7, 68, 2, and 34. |
Revision as of 16:54, 26 July 2015
│
български (bg) │
Deutsch (de) │
English (en) │
français (fr) │
日本語 (ja) │
한국어 (ko) │
русский (ru) │
中文(中国大陆) (zh_CN) │
1H - 練習問題 (著者: Tao Yue, 状態: 原文のまま修正なし)
さて、どう変数を使い、その値を変えるかを学んだ。最初のプログラミング課題をこなす準備はできただろうか?
しかし、ひとつ小さな問題がある。データをディスプレイにどう表示させるかを学んではいないということである。すべての情報がメモリーに保存されていてディスプレイに表示されていないとしたら、プログラムが動いたのかどうかを、どう知ることができるだろうか、それは無理である。
そこで、プログラミングを始めるために後のレッスンからの断片をここに示した。データを表示するためには、以下を使えばよい。
writeln (argument_list);
引数リストはコンマで区切られた文字列か変数からなる。以下は例である。
writeln ('Sum = ', sum);
1章の練習問題は以下である。
Find the sum and average of five integers. The sum should be an integer, and the average should be real. The five numbers are: 45, 7, 68, 2, and 34.
Use a constant to signify the number of integers handled by the program, i.e. define a constant as having the value 5.
Then print it all out! The output should look something like this:
Number of integers = 5 Number1 = 45 Number2 = 7 Number3 = 68 Number4 = 2 Number5 = 34 Sum = 156 Average = 3.1200000000E+01
As you can see, the default output method for real numbers is scientific notation. Chapter 2 will explain you how to format it to fixed-point decimal.
To see one possible solution of the assignment, go to the next page.
previous | contents | next |