1 / 9

Fortran 90

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.

Download Presentation

Fortran 90

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Fortran 90

  2. 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

  3. Description of Fortran -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.

  4. Advantages of Fortran -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

  5. Data Types and Constants 1. INTEGER a string of digits with an optional sign 0, -345, 789, +123 2 .REAL may be in scientific exponential form Decimal Form: 123.45, .123, 123. Exponential Form: 12.34E3, 123.3E+3 3. CHARACTER a string of characters enclosed between apostrophes or double quotes ‘John’ and “John”

  6. Free Format Output The WRITE Statement WRITE(*,*) WRITE(*,*) expr-1, expr-2, …, expr-n Output The READ Statement READ(*,*) READ(*,*) var-1, var-2, …, var-n

  7. Example 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

  8. Example 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)

  9. Resources http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/fortran.html http://www.nsc.liu.se/~boein/f77to90/f77to90.html#index

More Related