2007年1月28日 星期日

移出去的副程式,檔案內容不變

目的,是為了讓 主程式 瘦身。

同時,可以將 不同的副程式 歸類,
個別發展,交給不同的人 同時發展,
分工合作。



[pre]

! file: sj-01.inc

subroutine skip1(no)
implicit none
integer no, i

! limits no in 1 .. 20
if ((no >= 1) .AND. (no <= 20)) then
! no is OK!
do i=1, no
print *, ' '
end do
else
! no is invalid
print *, ' '
end if

end ! of sub. skip1()
! -----------------------------------------------

subroutine pause1
implicit none
integer no

print *, 'Input 0 for stop the program, others for continue: '
read(*, '(I2)')no

if (no .EQ. 0) then
stop
end if

end ! of sub. pause1()
! -----------------------------------------------

recursive integer function fs(no)
implicit none
integer no

if (no <= 1) then
fs= 1
return
else
fs= fs(no-1) + fs(no-2)
return
end if

end ! of fs()
! -----------------------------------------------
! end of file


[/pre]

沒有留言: