作者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