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 » » CSC112 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:28:20 PM

Jrb599
All American
8846 Posts
user info
edit post

P.M. Wraith.

[Edited on September 14, 2009 at 2:48 PM. Reason : ]

9/14/2009 2:47:55 PM

Perlith
All American
7620 Posts
user info
edit post

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

Perlith
All American
7620 Posts
user info
edit post

My guess was way off, see the duplicate thread in Tech Talk for a solution.

9/15/2009 6:57:01 AM

Wraith
All American
27257 Posts
user info
edit post

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

AstralAdvent
All American
9999 Posts
user info
edit post

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

Hurley
Suspended
7284 Posts
user info
edit post

Wraith was my fortran TA up in the Lizard lab way back when


I am forever grateful.

9/17/2009 1:37:47 PM

Wraith
All American
27257 Posts
user info
edit post

^Ah yeah, I remember you. That was waaaaay back in I think 2004.

9/18/2009 9:09:58 AM

joe_schmoe
All American
18758 Posts
user info
edit post

they're still teaching FORTRAN?

9/19/2009 6:05:54 PM

 Message Boards » Study Hall » CSC112 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.39 - our disclaimer.