I have written the following program:Program distanceImplicit NONEReal :: x1, x2, y1, y2write(*,*) "Enter the x coordinate of your fisrt point:"read(*,*) x1write(*,*) "Enter the y coordinate of your first point:"read(*,*) y1write(*,*) "Enter the x coordinate of your second point:"read(*,*) x2write(*,*) "Enter the y coordinate of your second point:"read(*,*) y2write(*,*) SQRT((x2-x1)^2 + (y2-y1)^2)end program distanceWhen i try to compile it i get this error message:write(*,*) SQRT((x2-x1)^2 + (y2-y1)^2) 1Error: Syntax error in argument list at (1)Can anyone tell me what is wrong with this?
9/14/2009 1:28:20 PM
P.M. Wraith.[Edited on September 14, 2009 at 2:48 PM. Reason : ]
9/14/2009 2:47:55 PM
I know nothing of FORTRAN, but I'll take a guess that last line:write(*,*) SQRT((x2-x1)^2 + (y2-y1)^2)You need to store this in a variable of some sort, THEN try to write out the variable. Again, a guess from knowing nothing of FORTRAN.Also, let me caution, the Computer Science department takes cheating VERY seriously in the CSC 11x courses. I'm not going to start a discussion of what or what is not cheating, but, make sure this TWW post does not count as cheating.[Edited on September 14, 2009 at 5:22 PM. Reason : .]
9/14/2009 5:20:42 PM
My guess was way off, see the duplicate thread in Tech Talk for a solution.
9/15/2009 6:57:01 AM
FORTRAN doesn't recognize carets. If you want to raise something to a power in FORTRAN, use two asterisks. It should read: WRITE (*,*) SQRT((x2-x1)**2 + (y2-y1)**2)Who is your FORTRAN TA? This should have been one of the first things they went over in the first lab. What else have they skipped over? Looks like you may have gotten a dud TA, we got a lot of those in CSC112. I used to be a TA, post any more questions you may have.
9/15/2009 8:42:30 AM
you can be a CSC112 TA after having taken the class once and getting a B or higher i think. aka i could've become, i took it a year ago and don't remember the slightest bit of fortran I'm AstralAdvent and i approved this message.
9/15/2009 2:36:57 PM
Wraith was my fortran TA up in the Lizard lab way back whenI am forever grateful.
9/17/2009 1:37:47 PM
^Ah yeah, I remember you. That was waaaaay back in I think 2004.
9/18/2009 9:09:58 AM
they're still teaching FORTRAN?
9/19/2009 6:05:54 PM