12.07.2015 Views

CAD in Civil Engineering - Baustatik-Info-Server

CAD in Civil Engineering - Baustatik-Info-Server

CAD in Civil Engineering - Baustatik-Info-Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Page 28 Computer Languages for Eng<strong>in</strong>eer<strong>in</strong>g - SS 132.7.3 Formatt<strong>in</strong>g, FORMAT StatementIf data should be formatted, we can use the format statement or we can use the parameter of the formatstatement as str<strong>in</strong>g as parameter 2 of the write statement. The general form of an output format is[m]Tw[.n].1. Format Type T• I, <strong>in</strong>teger format.• F, float format with fixed decimal po<strong>in</strong>t.• E, float format with exponential representation.• A, text format, the with of the format is optional.• X, output of spaces• /, a new l<strong>in</strong>e, l<strong>in</strong>ebreak2. repeat factor m3. width of the output field w4. number of significant digits n with<strong>in</strong> float formatt<strong>in</strong>g.If n is used <strong>in</strong> <strong>in</strong>teger formatt<strong>in</strong>gs, the lead<strong>in</strong>g blanks are filled with zeros.Formats can also be iterated by iteration factors. If more complex formats should be iterated, the formatblock must be bracketed by round parentheses. With<strong>in</strong> the follow<strong>in</strong>g example the output of 3 variablevalues a, b and c should be written. We use one format with an iteration of 3. The format starts with2 blanks (2x). Then a text will be written, (a format) and at the end the value of the variable shouldbe written us<strong>in</strong>g a fixed float format (f). The output should have a width of 10 with 2 digits after thedecimal po<strong>in</strong>t.1 c W| 1 2 3 4 5 6 72 c234567890123456789012345678901234567890123456789012345678901234567890123 write(*,8000) ’a=’,a,’b=’,b,’c=’,c4 8000 format(3(2x,a,f10.2))2.7.4 Read from Keyboard or FileThe read statement is similar to the write statement. We simply exchange source and dest<strong>in</strong>ation.The first parameter of the read statement passes the io channel. The second parameter passes the <strong>in</strong>putformat. If a * is given, the format is free. That is, the <strong>in</strong>put <strong>in</strong>formation units are separated by blanks(white spaces). Optionally a read io error can be handled by the iostat parameter.1 READ (, [,]) E. Baeck

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!