Difference between revisions of "Basic Pascal Tutorial/Chapter 2/Programming Assignment"

From Lazarus wiki
Jump to navigationJump to search
Line 1: Line 1:
 
{{Programming Assignment 2}}
 
{{Programming Assignment 2}}
  
2F - Programming Assignment (author: Tao Yue, state: unchanged)
+
2F - 練習問題 (著者: Tao Yue, 状態: 原文のまま修正なし)
  
Again find the sum and average of five numbers, but this time read in five integers and display the output in neat columns.
+
もう一度5つの数字の合計と平均を求めてみよう。ただし、今度は5つの整数を読み込み、きれいに列を揃えて出力表示させてみよう。
  
Refer to the original problem specification if needed. You should type in the numbers separated by spaces from the keyboard: <tt>45 7 68 2 34</tt>.
+
必要なら前の練習問題の指定を参照してみよう。数字はスペースで区切ってキーボードからタイプする。たとえば、次のように: <tt>45 7 68 2 34</tt>.
  
The output should now look like this:
+
出力は次のように表示されるようにすること。
 
  Number of integers = 5
 
  Number of integers = 5
 
   
 
   
Line 19: Line 19:
 
  Average:      31.2
 
  Average:      31.2
  
As an added exercise, you can try to write the output to a file. However, I won't use files in the problem solution.
+
追加の練習問題として出力をファイルに書き込んでみてもよい。ただし、問題の解答ではファイルは利用していない。
  
 
{|style=color-backgroud="white" cellspacing="20"
 
{|style=color-backgroud="white" cellspacing="20"
|[[EOLN_and_EOF|previous]]   
+
|[[EOLN_and_EOF/ja|previous]]   
|[[Contents|contents]]  
+
|[[Contents/ja|contents]]  
|[[Solution_2|next]]
+
|[[Solution_2/ja|next]]
 
|}
 
|}

Revision as of 19:55, 8 August 2015

български (bg) Deutsch (de) English (en) français (fr) 日本語 (ja) 中文(中国大陆)‎ (zh_CN)

2F - 練習問題 (著者: Tao Yue, 状態: 原文のまま修正なし)

もう一度5つの数字の合計と平均を求めてみよう。ただし、今度は5つの整数を読み込み、きれいに列を揃えて出力表示させてみよう。

必要なら前の練習問題の指定を参照してみよう。数字はスペースで区切ってキーボードからタイプする。たとえば、次のように: 45 7 68 2 34.

出力は次のように表示されるようにすること。

Number of integers = 5

Number1:      45
Number2:       7
Number3:      68
Number4:       2
Number5:      34
================
Sum:         156
Average:      31.2

追加の練習問題として出力をファイルに書き込んでみてもよい。ただし、問題の解答ではファイルは利用していない。

previous contents next