Fortran 90

9

description

Fortran 90. Background. The programming language Fortran is the dominating language for technical and scientific applications. It was developed originally at IBM in 1954 under the supervision of John Backus. John Backus in New Mexico, 1976. Description of Fortran. - PowerPoint PPT Presentation

Transcript of Fortran 90

Page 1: Fortran 90
Page 2: Fortran 90

The programming language Fortran is the

dominating language for technical and scientific

applications. It was developed originally at IBM

in 1954 under the supervision of John Backus.

Background

John Backus in New Mexico, 1976

Page 3: Fortran 90

-Fortran is the language for number crunching but

would not use for database development

-Fortran is superior to other languages for numerical

computation, many diverse and reliable libraries of

routines are available, an official standard exists which helps towards

portability.

Description of Fortran

Page 4: Fortran 90

-Fortran is a simple language-Fortran has always existed-Fortran compilers are generally available-Earlier the first programming language-Good at numerical analysis and technicalcal culations-Efficient compilers -The dominating language on supercomputers

Advantages of Fortran

Page 5: Fortran 90

1. INTEGER a string of digit s with an optional sign

0, -345, 789, +1232 .REAL may be in

scientific exponential formDecimal Form:

123.45, .123, 123.Exponential Form:

12.34E3, 123.3E+33. CHARACTER a string of characters enclosed between apostrophes or double quotes

‘John’ and “John”

Data Types and Constants

Page 6: Fortran 90

Output The WRITE StatementWRITE(*,*)WRITE(*,*) expr-1, expr-2, …, expr-n

Output The READ StatementREAD(*,*)READ(*,*) var-1, var-2, …, var-n

Free Format

Page 7: Fortran 90

PROGRAM VerticalBarChart IMPLICIT NONE CHARACTER(LEN *= ), PARAMETER :: Part1 = "(1X,

I5, A, "CHARACTER(LEN *= ), PARAMETER :: Part2 = "A,

A, I2, A )"CHARACTER(LEN=2 ) :: Repetition

CHARACTER(LEN=10), PARAMETER :: InputFormat ="(I5/(5I5 ))"

INTEGER :: Number, i, j INTEGER, DIMENSION(1:100 ) :: Data READ(*,InputFormat ) Number, (Data(i), i=1,

Number)DO i = 1, Number IF (Data(i ) /=0 ) THEN WRITE(Repetition,"(I2 )") Data(i ) WRITE(*,Part1 // Repetition // Part2 ) Data(i), "

|“, ("*",j=1,Data(i)), " (", Data(i), ")" ELSE WRITE(*,"(1X, I5, A, I2, A )") Data(i), " | (",

Data(i), ")" END IF END DO

END PROGRAM VerticalBarChart

Example

Page 8: Fortran 90

Suppose the input data consist of the following:14 8 27 24 40 45 38 26 16 3 5 4 0 2 1

The output of the program is:8 |******** ( 8) 27 |*************************** (27) 24 |************************ (24) 40 |**************************************** (40) 45 |********************************************* (45) 38 |************************************** (38) 26 |************************** (26) 16 |**************** (16) 3 |*** ( 3) 5 |***** ( 5) 4 |**** ( 4) 0 | ( 0) 2 |** ( 2) 1 |* ( 1)

Example

Page 9: Fortran 90

http://www.cs.mtu.edu/~shene/COURSES/cs201/

NOTES/fortran.html

http://www.nsc.liu.se/~boein/f77to90/f77to90.html#index

Resources