-
Notifications
You must be signed in to change notification settings - Fork 0
/
intro_to_fortran
58 lines (45 loc) · 1.73 KB
/
intro_to_fortran
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
function definitions
variable definitions
loading variables and saving variables
loops and function calls
http://en.wikibooks.org/wiki/Fortran/Fortran_Simple_math
https://www.nsc.liu.se/~boein/f77to90/a5.html
http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/chap02/funct.html
http://math.hawaii.edu/wordpress/fortran-1/
math functions such as
SQRT() to compute the square root of a number
x**y to compute the yth power of x
http://www.adt.unipd.it/corsi/Bianco/www.pcc.qub.ac.uk/tec/courses/f90/stu-notes/F90_notesMIF_7.html
C for reasons that are beyond me, all of the code starts with a tab
c a sentence that starts with a c is commented
c each code starts and ends with PROGRAM foobar and END PROGRAM foobar
PROGRAM foobar
IMPLICIT NONE
INTEGER :: a
INTEGER, PARAMETER :: b = 5
DOUBLE PRECISION :: c
print *, 'please enter the value of a'
read *, a
END PROGRAM
IF () THEN
ELSE IF () THEN
ENDIF
.GT. .LT. .GE. .LE. .EQ. .NE. are to be used in the control statements for comparison
one can also use .AND. .NOT. .OR. to use multiple comparisons for control
http://en.wikibooks.org/wiki/Fortran/Fortran_control
DO a,b,c
END DO
10 IF () THEN
ENDIF
GOTO 10
C will make the program return to the IF () THEN statement after
C executing whatever is in the if loop. this is a replacement for
C a while loop
http://www.infis.univ.trieste.it/fortran/control1.html
http://www.oc.nps.edu/~bird/oc3030_online/fortran/io/io.html
http://stackoverflow.com/questions/12002620/write-data-to-file-in-columns-fortran
http://www.math.hawaii.edu/~hile/fortran/fort7.htm
! can be used to comment lines
! what about starting a sentence with 'c'?!
https://www.nsc.liu.se/~boein/f77to90/a5.html - intrinsic functions
http://www.chem.ox.ac.uk/fortran/subprograms.html