Hi,
I'm new in this space, I have a problem building a program with Fortran95 (I'm also new on this). The program it's really easy, I have to make a random generator using RANMAR subroutine here is the code:
program random
use aleatorio; use SAVEDATA
Implicit none
real, allocatable :: V(:)
integer N
write(*,*) "Choose the numbers"
read (*,*) N
allocate (V(N))
call RANMAR (V,N)
write(*,*) "Numbers:",V
call keep()
deallocate (V)
stop
end program random
module SAVEDATA
contains
subroutine keep()
real, allocatable :: V(:)
integer N
integer :: i
character (len=30)::fileb
write (*,*) 'what is the name of your file?'
read (*,*) archivo
open (10,file=fileb, access='append')
do i= 1,N
write (10, *) V(i)
enddo
end subroutine keep
end module SAVEDATA
I've got problems with this subroutine, the other one works! here is the error warning:
Run-time Error
*** Error 112, Reference to undefined variable, array element or function result (/UNDEF)
SAVEDATA!KEEP - in file salvar.f95 at line 24 [+019c]
main - in file main.f95 at line 29 [+031a]
If somebody could tell me something about it, I'd be so thankful.
SPELUX11
I'm new in this space, I have a problem building a program with Fortran95 (I'm also new on this). The program it's really easy, I have to make a random generator using RANMAR subroutine here is the code:
program random
use aleatorio; use SAVEDATA
Implicit none
real, allocatable :: V(:)
integer N
write(*,*) "Choose the numbers"
read (*,*) N
allocate (V(N))
call RANMAR (V,N)
write(*,*) "Numbers:",V
call keep()
deallocate (V)
stop
end program random
module SAVEDATA
contains
subroutine keep()
real, allocatable :: V(:)
integer N
integer :: i
character (len=30)::fileb
write (*,*) 'what is the name of your file?'
read (*,*) archivo
open (10,file=fileb, access='append')
do i= 1,N
write (10, *) V(i)
enddo
end subroutine keep
end module SAVEDATA
I've got problems with this subroutine, the other one works! here is the error warning:
Run-time Error
*** Error 112, Reference to undefined variable, array element or function result (/UNDEF)
SAVEDATA!KEEP - in file salvar.f95 at line 24 [+019c]
main - in file main.f95 at line 29 [+031a]
If somebody could tell me something about it, I'd be so thankful.
SPELUX11
0 commentaires:
Enregistrer un commentaire