-
Notifications
You must be signed in to change notification settings - Fork 0
/
TEMPLATE.f90
46 lines (37 loc) · 1.02 KB
/
TEMPLATE.f90
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
! ??????????????????????????
! author name
! additional details
! FORTRAN PROGRAM TEMPLATE 101
! does not work on its own; must define variables and values properly
! use any text editor/IDE to write/modify the code
! use "gfortran FILENAME.f90 -o FILENAME" to compile
! then "./FILENAME" to run
PROGRAM name
IMPLICIT NONE
REAL::var1
REAL, PARAMETER::var2
CHARACTER::var3
INTEGER::var4
! basic input and storing value to variable
WRITE (*, '(a)', advance='no') "Input statement context : "
READ (*, *) variable
! if conditionals demo
IF ( conditional ) THEN
! do what
PRINT *, "if demo 1"
ELSE IF ( conditional ) THEN
! do what
PRINT *, "if demo 2"
END IF
! select case conditionals demo
SELECT CASE ( something )
CASE ( conditional value )
! do what
CASE ( conditional value )
! do what
END SELECT
! output normal
WRITE (*, *) "Text"
! output formatted
WRITE (*, '(a, f5.2)') "Text", floatvalue ! total 5 digits, 2 digits shown after decimal
END PROGRAM name