V.I.P Veteran 194 Posts user info edit post |
I have written the following program:
Program distance Implicit NONE Real :: x1, x2, y1, y2 write(*,*) "Enter the x coordinate of your fisrt point:" read(*,*) x1 write(*,*) "Enter the y coordinate of your first point:" read(*,*) y1 write(*,*) "Enter the x coordinate of your second point:" read(*,*) x2 write(*,*) "Enter the y coordinate of your second point:" read(*,*) y2 write(*,*) SQRT((x2-x1)^2 + (y2-y1)^2)
end program distance
When i try to compile it i get this error message:
write(*,*) SQRT((x2-x1)^2 + (y2-y1)^2) 1 Error: Syntax error in argument list at (1)
Can anyone tell me what is wrong with this? 9/14/2009 1:29:35 PM |
AstralEngine All American 3864 Posts user info edit post |
Fortran doesn't take ^ for exponentiation, you have to use **.
I realized, after clicking "reply to topic" that sarijoul was telling you this, and not adding to qntmfred's mockery of you.
lolz and apologies to sarijoul, gg
[Edited on September 14, 2009 at 6:25 PM. Reason : ] 9/14/2009 6:24:57 PM |