[問題] 請問一題計摡

看板TransCSI作者 (allie必勝anessa!!XD)時間19年前 (2006/06/29 17:42), 編輯推噓0(004)
留言4則, 3人參與, 最新討論串1/1
Q:Suppose you want to interchange the values stored in cell number 2 and number 3, What is wrong with the following steps: (Design a correct procedure after correcting it) step1.move the contents of cell number 1 to cell number 2 step.2 move the contents of cell number 2 to cell number 1 我看了解答它是說這兩個步驟會導致兩個cell都會同樣包含原本cell number 2 的內容 原因是? 正確的步驟好像是把cell number2 內容先移到另一個cell number 1 然後再把 number3移到number2 最後再把number1移到number3 請問為什麼要這樣做? 謝謝指教 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.164.100.133 ※ 編輯: minikitty 來自: 218.164.100.133 (06/29 17:52)

06/29 18:01, , 1F
因為電腦很笨 ...不幫他換 他不會換 ...
06/29 18:01, 1F

06/29 18:02, , 2F
這就跟寫程式的 swap一樣 ...
06/29 18:02, 2F

06/29 18:10, , 3F
cell no.2 移到 cell no.1 cell no.1就被覆蓋了 找不回來
06/29 18:10, 3F

06/30 01:18, , 4F
喔喔 謝~
06/30 01:18, 4F
文章代碼(AID): #14ew2PE8 (TransCSI)