Professional Documents
Culture Documents
With Fortran by Dr. Agus Dwi Anggono
With Fortran by Dr. Agus Dwi Anggono
By
Dr. Agus Dwi Anggono
What Is a Programming Language?
Formal notation for specifying computations,
independent of a specific machine
Example: a factorial function takes a single non-negative
integer argument and computes a positive integer result
Mathematically
Set of imperative commands used to direct computer
to do something useful
Print to an output device: print (hello world\n);
What mathematical function is computed by print?
List of programming languages groups
Array language
Assembly languages
Command line interface languages
Compiled languages
Concurrent languages
Curly-bracket languages
Dataflow languages
Data-oriented languages
Data-structured languages
Etc
Array language
Known as vector or multidimensional languages
generalize operations on scalars to apply transparently
to vectors, matrices, and higher-dimensional arrays.
Such as: Fortran, Matlab, A+, J
Assembly languages
Directly correspond to a machine language so machine
code instructions appear in a form understandable by
humans.
Assembly languages lets programmers use symbolic
addresses, which the assembler converts to absolute
addresses.
Example: Assemble
Command line interface languages
called batch languages, or job control languages.
Examples:
DOS (for the IBM PC running DR-DOS, MS-DOS, or
PC DOS before Windows)
4DOS (extended command-line shell for IBM PCs)
Expect (a UNIX automation and test tool)
Compiled languages
Processed by compilers, though theoretically any
language can be compiled or interpreted.
Examples :
BASIC (some dialects, including the first version of
Dartmouth BASIC)
C; C++; Java; Visual Basic (VB) ; Phyton
Fortran
COBOL
Delphi
Data-oriented languages
Powerful ways of searching and manipulating the
relations.
Examples:
SQL
WebQL
Visual FoxPro
Clipper
dBase
What is Fortran?
Fortran is a general purpose programming language,
mainly intended for mathematical computations in
science / engineering applications.
Fortran started in the 1950's at IBM
Fortran 66, Fortran 77 and Fortran 90 (95)
Fortran 2003
Visual Fortran (2007)
Why learn Fortran?
Fortran is the dominant programming language used
in engineering
Fortran is the most enduring computer programming
language in history
Fortran has survived and will survive is software
inertia.
Basic Fortran
A Fortran program is just a sequence of lines of text. The text has to
follow a certain syntax to be a valid Fortran program.
program circle
real r, area
c This program reads a real number r and prints
c the area of a circle with radius r.
write (*,*) 'Give radius r:'
read (*,*) r
area = 3.14159*r*r
write (*,*) 'Area = ', area
stop
end
Program organization
A Fortran program generally consists of a main program (or
driver) and possibly several subprograms (or procedures or
subroutines).
For now we will assume all the statements are in the main
program; subprograms will be treated later.
The structure of a main program is:
program name
declarations
statements
stop
end
Column position rules
The most important rules are the column position rules: