Chapter5 - ComputerProgramming usingFortran77...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Programming using Fortran 77 Chapter 5 - Input/Output
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Formatting the I/O how many output positions for vars to line up headings on a report programmer supplied, not by the compiler PRINT  format-specifier output-list format-specifier   1) * 2) char expr for output 3) label for format stmt output-list : single expression or list of expressions  with a ","
Background image of page 2
Examples PRINT * , ‘AT TIME’,TIME, ‘VELOCITY IS’, VELOC PRINT ‘(A, F6.2, A, F6.3)’, ‘AT TIME’, TIME, ‘VELOCITY IS’,  VELOC      PRINT 10 , TIME, VELOC    10  FORMAT (1X, ‘AT TIME’, F6.2, ‘VELOCITY IS’, F6.3)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
FORMAT syntax FORMAT ( list of format descriptors ) FORMAT (1x, I5, F8.2) FORMAT (1x, 2I4, 2F6.3, F8.3) FORMAT (1x, A3) 1X = control char = SINGLE SPACE
Background image of page 4
FORMAT Example PRINT  75 , ‘JOHN DOE’, ‘CPSC’, NUMBER FORMAT ( 1X, A10, A4, 2X, I3 ) J  O  H  N  _ D  O  E  _ _ C  P  S  C  _ _ 1  4  1    75
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
FORMAT Example integer number real temp print *, number, temp OR print '(1x, I5, F8.2)', number, temp OR print 20, number, temp 20 format(1x, I5, F8.2) output - compiler dependant --17---10.25000 output ---17---10.25 Page 258 Table 5.1 - Format descriptors
Background image of page 6
Control Characters controls print head single space, double space, new page, etc. will use the first position of a print stmt always use 1st format descriptor for the control var Example: print '(1x, I5, F8.2)' , number, temp 1x = control char = single space Page 259 in book other control chars
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Integer output - I descriptor Syntax:    rIw or rIw.m I = integer data w = width allowed for data r = repetition indicator m = minimum digits to display Example: num = 3 left = 5378 kappa = -12345 print'(1x, 2I5, I7, I10)', num, num - 3, left, kappa
Background image of page 8
Integer output - I descriptor Syntax:    rIw or rIw.m I = integer data w = width allowed for data
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/18/2011 for the course CMPS 301 taught by Professor Staff during the Fall '08 term at University of Louisiana at Lafayette.

Page1 / 32

Chapter5 - ComputerProgramming usingFortran77...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online