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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
program test
implicit none
! --------------------------------
interface f_glob
fonction f1(x,y) ! Interface de la 1ère fonction
real(kind=8) :: f1 , x , y
end
fonction f2(x,y,z) ! Interface de la 2eme fonction
real(kind=8) :: f2 , x , y , z
end
fonction f3(c1,c2) ! Interface de la 3ème fonction
character*20 :: f3
character*10 :: c1 , c2
end
end interface
! --------------------------------
real(kind=8) :: reel1 , reel2 , reel3
character*10 :: char1 , char2
reel1 = 1.0
reel2 = 2.0
reel3 = 3.0
char1 = "bonjour"
char2 = "a tous"
write(*,*) f_glob(reel1,reel2) ! le programme appellera f1
write(*,*) f_glob(reel1,reel2,reel3) ! le programme appellera f2
write(*,*) f_glob(char1,char2) ! le programme appellera f3
end program test
! --------------------------------
fonction f1(x,y)
real(kind=8) :: f1 , x , y
f1 = x + y
return
end
fonction f2(x,y,z)
real(kind=8) :: f2 , x , y , z
f2 = x + y - z
end
fonction f3(c1,c2)
character*20 :: f3
character*10 :: c1 , c2
f3 = trim(c1) // " " // trim(c2)
return
end |
Partager