Professional Documents
Culture Documents
Fortran M1
Fortran M1
2016
. .
george.papalambrou@lme.ntua.gr
( )
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
1 FORTRAN.
2 , , , , .
3 , , , .
4 : , .
.
5 , /.
6 : ,
, , , .
7 : , ,
, , , .
8 : , ,
, , .
9 FORTRAN (C/C++, MATLAB).
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
Silverfrost Plato
1 http://www.silverfrost.com/,
2
3 FORTRAN 95, Windows
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
PROGRAM square_root_example
PROGRAM square_root_example
! G. Papalambrou
! comments start with exclamation mark
IMPLICIT NONE
REAL :: x,y
INTRINSIC SQRT ! Standard FRTRN functions
! Command line interface. Ask a number and read it
WRITE (*,*) Give a value (number) for x:
READ(*,*) x
y=x**2+1 ! power function and arithmetic
WRITE (*,*) Given value for x:,x
WRITE (*,*) Computed value of x**2+1:,y
! Print the sqrt of y to screen
WRITE (*,*) Computed value of SQRT(x**2+1):,SQRT(y)
END PROGRAM square_root_example . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
PROGRAM square_root_example
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
PROGRAM square_root_example
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
1
(!).
!!
: REAL :: x,y
: INTRINSIC SQRT
interface : WRITE (*,*) Give a value
(number) for x:
: READ(*,*) x
: y=x**2+1
: WRITE (*,*) Given value
for x:, x
:
WRITE (*,*) Computed...:, SQRT(y)
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
2
FORTRAN 95/2003.
PROGRAM <
> END PROGRAM
< >.
IMPLICIT NONE ,
.
FORTRAN 95 .
, IMPLICIT ,
i, j, . . . , n
(type integer), ,
(real), .
FORTRAN 95 .. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
3
132
(FR77: 80 ).
O
compiler.
&
.
31 .
.
REAL :: x,y Real :: x,Y .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
4
Real :: x,y x,y.
Integer :: i, n.
i,n
x,y -o .
. ,
,
(
)
.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
5
main.f95, .
FORTRAN 95. FORTRAN 90
main.f90.
READ, WRITE standard
interface (command line),
.
interface text,
,
, .
read(*,*) a,b 1
standard
input, 2 a,b
, . ,
, tabs, , . .
.
.
.
.
. . . . .
. . . .
. . . .
. . . .
. . . .
. . . . .
.
.
.
.
.
.
.
.
.
. FORTRAN
6
FRTRN
( compiler),
object.
compilation.
object
( linker),
(executable). exe
.
compilation link Build.
(Run)
.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
7
PLATO IDE (Integrated
Development Environment), .
compilation, linking, creating executable.
(Unix-Linux),
command line (shell) (script).
PLATO Build
compilation, linking, creating executable ,
.
compilation, linking, executable
(: Executable is up to date).
Build Start Run
(
. . . . . . . . . . . . . . . . . . . .
). . . . . . . . . . . . . . . . . . . . .
. FORTRAN
8
,
- (Step).
Build
Step into,
.
mode debug, .
.
debug .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
mode debug
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
site http://www.silverfrost.com/
Silverfrost FTN95: Fortran for Windows,
PLATO, FTN95s native IDE,
.
.
Project .
File| New Project Fortran
Application. o editor o source
. .
Build | Build Build | Run
command
window. Return
. !
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
PLATO
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. FORTRAN