MODULE base IMPLICIT NONE INTERFACE SomPro PROCEDURE SomProR4 PROCEDURE SomProR8 END INTERFACE CONTAINS ELEMENTAL FUNCTION SomProR4(a,b,c) RESULT(r) IMPLICIT NONE REAL, INTENT(IN) :: a,b,c REAL :: r r = a + (b*c) RETURN END FUNCTION ELEMENTAL FUNCTION SomProR8(a,b,c) RESULT(r) IMPLICIT NONE REAL(8), INTENT(IN) :: a,b,c REAL(8) :: r r = a + (b*c) RETURN END FUNCTION END MODULE base PROGRAM SomProPoli USE base IMPLICIT NONE REAL :: x=1.0,y,z REAL(8) :: xd,yd,zd REAL, DIMENSION(:), ALLOCATABLE :: vx,vy,vz INTEGER :: n=1, st DO WHILE(x /= 0.0) PRINT*,"Trasmetti 3 valori reali x, y, z:" READ*,x,y,z PRINT*,"x + y*z = ",SomPro(x,y,z) xd=x; yd=y; zd=z PRINT*,"xd + yd*zd = ",SomPro(xd,yd,zd) PRINT*,"Trasmetti la lunghezza del vettore:" READ*,n ALLOCATE(vx(n),vy(n),vz(n),STAT=st) IF (st /= 0 ) STOP "Errore allocazione vettori" vx=x; vy=y; vz=z PRINT*,"Il risultato vettoriale e' ",SomPro(vx,vy,vz) END DO STOP END PROGRAM SomProPoli