本區搜索:
Yahoo!字典
打印

[ICT] ONE question about Array

ONE question about Array

Question: Design an algorithm with a WHILE-loop for finding the mean of the elements in an array of the numeric type.

ANS:




Shouldnt there be a step 'Input item*' before 'sum = sum + item*' ?

*There should be a 'i' here. There is error it cant show.

Please post here if you know. Thank you!!!!!!

   

TOP

[隱藏]
吾係好明你問咩,,不過都試下解一解,
我估你係問緊點解"i = i +1;" 吾可以響" sum = sum + i;" 前面,
其實好簡單,
如果你行左i果句先, 咁個sum就會係sum=sum+"2",
因為你個i 加左1;

其實你係問個array定係問緊個loop嫁!?

TOP

你可以當佢叫你寫一個procedure(唔係成個program), aim to find the mean of one element. 至於 item 既array 係咩呢,,就可以唔洗理喇. 所以答案冇錯. (如果你話要加 readln(item) 既,,咁 how about n? ,,所以唔洗加 Input item* ).

TOP

重要聲明:小卒資訊論壇 是一個公開的學術交流及分享平台。 論壇內所有檔案及內容 都只可作學術交流之用,絕不能用商業用途。 所有會員均須對自己所發表的言論而引起的法律責任負責(包括上傳檔案或連結), 本壇並不擔保該等資料之準確性及可靠性,且概不會就因有關資料之任何不確或遺漏而引致之任何損失或 損害承擔任何責任(不論是否與侵權行為、訂立契約或其他方面有關 ) 。