就是 程式設計指令的執行,是按照一定的順序
依序執行。
兩個變數的值作交換的動作的範例,
就是 順序結構
temp= x
x= y
y= temp
以上這三行程式,如果把順序弄亂了,
是否 仍然會得到 正確的結果。
請詳細 思考一下。
[pre]
! begin of main()
implicit none
integer x,y, temp
x= 123
y= 456
print *, 'x= ', x, ', y= ', y
pause
! swap the value of x, y
temp= x
x= y
y= temp
! ----------------------
print *, 'x= ', x, ', y= ', y
pause
end
[/pre]
沒有留言:
張貼留言