看板 Grad-ProbAsk 關於我們 聯絡資訊
中興102資管計概第16題 x := 1; i := 1; while (x <= 1000) x := power(2,x); i := i+1; 求i值 我算兩遍i都是5 但是解答給4 解答的說明是x在第五次執行 x := power(2,x)時就大於1000並離開迴圈 所以最後一次的i=i+1沒有執行 我的問題是 pseudo code可以這樣子不用break就直接離開while loop嗎? 還是說解答是錯的? 拜託各位高手們了 thanks -- Sent from my Windows Phone -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 116.59.126.157 ※ 文章網址: https://www.ptt.cc/bbs/Grad-ProbAsk/M.1422353509.A.3A2.html
kather: 5吧 01/27 19:13
shcyril: 5 01/27 19:17
Moonshark: 5 01/27 21:53