User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Fortran programming question Page [1]  
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

qntmfred
retired
40551 Posts
user info
edit post

Quote :
""Enter the x coordinate of your fisrt point:""


there's ya problem

9/14/2009 1:39:54 PM

sarijoul
All American
14208 Posts
user info
edit post

^ should be **

9/14/2009 1:45:55 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

 Message Boards » Tech Talk » Fortran programming question Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.