- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Hi
i was using a simple DO cmd ::
DO ( i.lt.10 .and. error.lt.(1e-4))
and this happened ::
Error 1 error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: <IDENTIFIER>
VS 2013
so i dont know whats wrong here... need help
- Etiquetas:
- Intel® Fortran Compiler
Enlace copiado
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
There is not enough information to do anything more than make a wild guess here.
Can you show more of the program?
--Lorri
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
program Console8
implicit none
Real::X1,Xm,F(x),Fd(X),error
integer::i
F(x)=tan(x)-x
Fd(x)=tan(x)**2
error=1.0
i=1.0
1 print*,'please enter a number close to root'
Read*,Xm
DO ( i.lt.10 .and. error.lt.(1e-4))
X1=Xm-(F(Xm)/Fd(Xm))
X1=Xm
i=i+1
error=abs(X-Xm)
end do
print*,'root is',X1 , 'error is' , error
go to 1
pause
end program Console8
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
That one line is not complete Fortran syntax. Perhaps it was intended to be
do while(...)
and some references have said it would be preferable to use
do
if(.not.( i.lt.10 .and. error.lt.(1e-4))) exit
.....
end do
The error message seems a little off target, as I don't see how appending an identifier could make it meaningful.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
now i changd code to this
program Console5
!Amir Abbas Falsafi
implicit none
Real,parameter::error=1e-4 , pi=3.141592
integer::i=1
Real::Xm,T
Real::F,FF,X,Xm2
5 Read*,Xm
Xm2=Xm*180/pi
Do while(I.lt.10.and.F(X).gt.error)
X=Xm-((tan(Xm2)-Xm)/(tan(Xm2)**2))
print*,'Xo is',X ,'times repeated=',i
Xm=X
i=i+1
end do
go to 5
end program Console5
and now what i get is more interesting
Error 1 error LNK2019: unresolved external symbol _F referenced in function _MAIN__ Console8.obj
Error 2 fatal error LNK1120: 1 unresolved externals Debug\Console8.exe
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
The declaration of F as real and the subsequent appearance in an expression of F(X) signify to the compiler that F is an external function of type real with one real argument. You have to supply the source code of that function.
If the code is intended to solve an algebraic equation by regula-falsi or something similar, note that the convergence check that you use may fail to do what was intended.

- Suscribirse a un feed RSS
- Marcar tema como nuevo
- Marcar tema como leído
- Flotar este Tema para el usuario actual
- Favorito
- Suscribir
- Página de impresión sencilla