Tuesday, January 31, 2006

Starting FORTRAN

A free Fortran compiler: G95.

Download and install the binary under "Self-extracting Windows x86." Install to the C:\g95 directory.

Now, make your first program, to print 'Hello World' ten times. Spacing matters:


PROGRAM HELLO
DO 10, I=1,10
PRINT *,'Hello World'
10 CONTINUE
STOP
END


save this file as hello.f in the c:\g95\bin directory.
from the c:\g95\bin directory, type the following:
g95 hello.f

The compiler will create hello.exe in the same directory. Run it.

Now edit the file and create a syntax error. Change * to *a. Try to recompile and see what happens.

No comments: