[PDF] [PDF] Basic I/O Concepts – FORTRAN 90 Chapter 5 of Textbook

The first WRITE() statement uses the freeform (*,*) format and is by far the most forgiving and easiest to use FORTRAN will handle all of the formatting using the minimum amount of space necessary to hold the data to be displayed and separate each data item by a single space



Previous PDF Next PDF





[PDF] Fortran 90 Input and Output (I/O)

The input/output system translates data between user- readable character form and internal binary form in the computer memory • List-directed (or Default) format



[PDF] COURS DE FORTRAN 90 - Institut de Mathématiques de Bordeaux

gros codes de calculs – 1990 : Fortran 90, fortran devient un langage moderne ( format write (* ,*) 'Au c l a i r de l a lune , mon ami P i e r r o t Prete moi



[PDF] Basic I/O Concepts – FORTRAN 90 Chapter 5 of Textbook

The first WRITE() statement uses the freeform (*,*) format and is by far the most forgiving and easiest to use FORTRAN will handle all of the formatting using the minimum amount of space necessary to hold the data to be displayed and separate each data item by a single space



[PDF] Contouring and Analysis

FORTRAN 90: Formatted Input/Output PRINT format-descriptor, output-list What do format descriptors look like? • Table 5-1 • Example: – PRINT '(I3)', N



[PDF] Elements de programmation Fortran

évolué ces derni`eres années avec l'apparition de la norme Fortran 90 (puis 95, 2003, 2008) Si on suit le format fortran 77, on nommera le fichier program f print*,'Voici un '//'exemple de declaration et attribution de variables' print*,'Bis : ' 



[PDF] LECTURE 11: Formating To make columns line up in Fortran, you

To make columns line up in Fortran, you must use format statements Instead of print *, write # format( *** ) where # is an arbitrary number (usually with 3 



[PDF] Simple File Input & Output 1 The OPEN statement

Fortran 90 has a wealth of commands for I/O and in this course we will only study a few of them For example your matrix library module could be written so that it 



[PDF] Fortran Reference Guide - PGI Compilers & Tools

Fortran Arrays, describes special characteristics of arrays in Fortran 90/95 Input and Output, describes the input, output, and format statements that allow



[PDF] Getting started with Fortran - PRACE Events

Fortran 90 (1991) a major revision and Fortran 95 (1997) print the square root of the argument y to screen format descriptors in connection with the write



FORTRAN 90 STANDARD STATEMENT KEYWORDS

are summarized in Table A I, and Fortran 90 statement keyword con- texts that are not carried over ADVANCE= specifier In READ or WRITE statement Array specification ASSIGN statement or any form of GO TO statement Derived-type  

[PDF] fortran 90/95 pdf

[PDF] fortran 95 compiler

[PDF] fortran 95 continuation line

[PDF] fortran 95 do loop

[PDF] fortran 95 download

[PDF] fortran 95 manual

[PDF] fortran 95 tutorial

[PDF] fortran 95 write

[PDF] fortran 95/2003 explained

[PDF] fortran command

[PDF] fortran exercises

[PDF] fortran grammar

[PDF] fortran manual

[PDF] fortran parameter

[PDF] fortran syntax cheat sheet

Basic I/O Concepts - FORTRAN 90

Chapter 5 of Textbook

Formatting output in FORTRAN is incredibly flexible and can be complicated. We will not utilize most of the capabilities. Instead, we will concentrate on the most useful basics. This handout is designed to give you the basics of formatting input and output in your FORTRAN programs. A thorough reading of Chapter 5 in the text may be needed to solidify your understanding and use of these statements. It will also give you some more advanced understanding of items not covered in this handout.

I/O Descriptors

The following descriptors are used to properly format our data.

I integer output

F real output

E real output (exponential notation)

ES real output (scientific notation)

L logical output (T or F)

A character output

X space output

T tab output (we won't cover beyond this)

/ slash descriptor - used to insert blank lines

Symbols used with format descriptors

Symbol Meaning

c

Column number

d Number of digits to right of the decimal place for real input or output m

Minimum number of digits to be displayed

n

Number of spaces to skip

r Repeat count - the number of times to use a descriptor or group of descriptors w Field width - the number of characters to use for the input or output (This table is from the textbook p.178) Theses symbols will be referenced in the next two tables.

WRITE Statements (p. 173 - 196)

WRITE() statements may be written in several different formats. We are going to introduce only the two most common. You are free to review and use the others as you see necessary. Page

Descriptor Data Type Data Value Form

at Output

178 rIw

rIw.m integer 317 I3

I4 317

..317

178 rFw.d real (floating

point)

37.9139 F6.3

F7.1

F8.5 37.914

...37.9

37.91390

179 rEw.d exponential

180 rESw.d scientific

181 rLw logical

We won't be using these format descriptors.

182 rA

rAw character I love CS154! A A12 A13

A17 I love CS154!

I love CS154

I love CS154!

....I love CS154!

NOTE: (.) equals a space in above examples!

182
-182 nX space X 3X . 182
-183 Tc tab (to a col. #) T10

T35 Tabs to col 10

Tabs to col 35

184 / newline /// Enters 3 blank lines

Now let's put it all together in a WRITE statement

WRITE(*, *) 'The 2004 Cubs will win', wins, 'games!' WRITE(*, 10) 'The 2004 Cubs will win', wins, 'games!' WRITE(*, 10) 'The 2004 Cubs will win ', wins, ' games!' 10 FORMAT(10x, a, I3, a) Produce the following: The 2004 Cubs will win 105 games! The 2004 Cubs will win105games! The 2004 Cubs will win 105 games!

Let's examine the differences and figure out why they occurred. The first WRITE() statement uses the freeform (*,*) format and is by far the most forgiving and easiest to use. FORTRAN will handle all of the formatting using the minimum amount of space necessary to hold the data to be displayed and separate each data item by a single space. The second and third WRITE() statements use the 10 FORMAT() statement but achieve different results. This is important to notice! The second statement runs our words together making them unreadable because we did not include any spaces inside of the single quoted strings. The third statement prints as expected because we have included a space both after win and before games. The last item I want you to notice about the output is that the output using the FORMAT() statement start 10 columns farther to the right. This is a result of using the 10x descriptor in the format statement. Good programming states that you should always start your output at least one space to the right of the margin. This is not going to happen with the WRITE(*,*). We don't want to confuse or overwhelm you with the plethora of options available so we will limit our discussion to what we have covered. Be aware that you will see many variations in the text book and elsewhere. If you can't figure out what the format statements are doing come to office hours or talk to your lab instructor for further assistance.

READ Statements (p. 197 - 202)

READ() statements like WRITE() statements may be written in many different formats. We are going to introduce only the basics. You are free to review and use the others as you see necessary. Page

Descriptor Data Type Data Value Form

in read() Value Saved in variable

198 rIw

rIw.m integer 317 I3

I4 317

317

178 rFw.d real (floating

point)

37.9139 F6.3

F7.1

F8.5 37.913

37.9

37.91390

179 rEw.d exponential

180 rESw.d scientific

181 rLw logical

We won't be using these format descriptors.

182 rA

rAw character I love CS154! A A3 A5

A9 I love CS154!

54!
S154! ...CS154!

NOTE: (.) equals a space in above examples!

182
-182 nX space X 3X . 182
-183 Tc tab (to a col. #) T10

T35 Tabs to col 10

Tabs to col 35

184 / newline /// Skips 3 lines

Please look at the examples in chapter 5 for more detail.quotesdbs_dbs17.pdfusesText_23