# 我不懂這題目問的意思~C++程式!!!

1. Read in integers until -999 is typed in. Print out the number of integers typed in. The last number, -999, does not count.

2. Same condition as the previous problem, but print out the sum of these integers instead. Take proper action when no integers are read in.

3. Same condition as before, print out the average of these integers.

4. Same condition as before, print out the number of integers that are positive.

5. Same condition as before, print out the sum of those integers that are positive.

6. Same condition as before, print out the average of those integers that are positive. Take proper action when no integers are read in.

7. Same condition as before, print out the value of the largest integer typed in.

8. Same condition as before, print out the value of the smallest integer typed in.

9. Same condition as before, print out the number of integers that is equal to the largest value in Problem 7.

10. 期中考有這樣一題：

for (i=1; i<=199; i+=2)

cout << i << endl;

!!!此題很難，尤其是當輸入值不合理時，如1, 3, 5, -100。可假設輸入參數合理，但你必須正確處理上行或下行兩種可能。

Update:

Rating
• Anonymous

1. Read in integers until -999 is typed in. Print out the number of integers typed in. The last number, -999, does not count.

你要寫個程式讓使用者不斷的輸入數字

如果輸入-999就停止,然後印出使用者剛剛共輸入幾個數字,

但是最後那個數字(也就是-999)不能算進去

-------------------------------------

2. Same condition as the previous problem, but print out the sum of these integers instead. Take proper action when no integers are read in.

印出上題那些數字的總和(除了最後那個-999)

如果使用者沒有輸入任何數(也就是一開始就輸入-999),請讓程式作適當的處理

-------------------------------------

3. Same condition as before, print out the average of these integers.

同上題,印出那些數的平均

-------------------------------------

4. Same condition as before, print out the number of integers that are positive.

同上題,告訴使用者共輸入幾個"正整數"(類似第一題)

-------------------------------------

5. Same condition as before, print out the sum of those integers that are positive.

同上題,把這些正整數加總在輸出(類似第二題)

-------------------------------------

6. Same condition as before, print out the average of those integers that are positive. Take proper action when no integers are read in.

同上題,印出這些正整數的平均值(類似第三題)

-------------------------------------

7. Same condition as before, print out the value of the largest integer typed in.

還是同上題,這題要你印出最大的數字

-------------------------------------

8. Same condition as before, print out the value of the smallest integer typed in.

又是同上題,請印出最小的數

-------------------------------------

9. Same condition as before, print out the number of integers that is equal to the largest value in Problem 7.

仍然是同上題...印出有幾個數等於最大的數(例如最大的是7,你要找出使用者輸入的數裡面有幾個數字是7)

-------------------------------------

2006-11-01 16:20:21 補充：

第10題麻煩說清楚一點