1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
! MYPROG.F90 responds to command switches -r, -c and/or -d
use DFLIB
integer(4) count, num
integer(2) i, status
character(80) buf
real r1 / 0.0 /
complex c1 / (0.0,0.0) /
real(8) d1 / 0.0 /
num = 5
count = NARGS()
do i = 1, count-1
call GETARG(i, buf, status)
if (buf(2:status) == 'r') then
r1 = real(num)
write(*,*) 'r1 = ',r1
else if (buf(2:status) == 'c') then
c1 = cmplx(num)
write(*,*) 'c1 = ', c1
else if (buf(2:status) == 'd') then
d1 = dble(num)
write(*,*) 'd1 = ', d1
else
write(*,*) 'Invalid command switch'
exit
end if
end do
end |
Partager