作者minikitty (allie必勝anessa!!XD)
看板TransCSI
標題[問題] 請問一題計摡
時間Thu Jun 29 17:47:46 2006
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)
1F:→ xsque:因為電腦很笨 ...不幫他換 他不會換 ... 06/29 18:01
2F:→ xsque:這就跟寫程式的 swap一樣 ... 06/29 18:02
3F:→ guestoo:cell no.2 移到 cell no.1 cell no.1就被覆蓋了 找不回來 06/29 18:10
4F:→ minikitty:喔喔 謝~ 06/30 01:18