Chapter2 - 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 2 - DATA TYPES AND  OPERATIONS
Background image of page 1

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

View Full DocumentRight Arrow Icon
FORTRAN  Intro Fortran - Formula Translation  one of the first HLL  developed by IBM in the mid 50s  John Backus was the lead Many companies begin to develop there own version of Fortran  which lead to a set of standards:  ANSI - American National Stds Institute  Fortran 66 - 1st version of Fortran  Fortran 77 - most popular  Fortran 90 - most recent   Fortran 2005 - from IBM
Background image of page 2
Program Composition and Format 3 parts of a Fortran program  - a column type language heading pgm name - Program assn1 opening documentation - pgmer, date, descr , etc start with an * those lines are not compiled by the compiler good for understanding the pgm may go anywhere in the pgm specification - create the working storage area names and types of vars and constants stores the data mailbox setup Example:  integer num1, num2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Program Composition and Format Execution- action steps of the pgm Example:  print *, 'enter 2 numbers' I/O read *, num1, num2 I/O * assignment stmt answer = num1 + num2 end  last stmt in a fortran pgm tells compiler no more code an exe stmt part of the execution section
Background image of page 4
FORTRAN  Programs Specific structure each line ( 80 columns )  program statements from columns 7 - 72  program statements have to be valid FORTRAN statements  Statement number from columns 1 - 5  Column 6 ( continuation if any )  * or C  in column 1 denote a comment line  FORTRAN compiler ignores columns 73 - 80 
Background image of page 5

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

View Full DocumentRight Arrow Icon
Data Computer manipulates  DATA Letters, digits, strings Types Integer Real Character Logical
Background image of page 6
Data Types Integer  - digits that does not contain commas or decimals negative must have - in front positive + is optional example 0 - yes  5,280 - no commas 137 - yes  16.0 - no decimals +145 - yes  7- - no the - in front Real  - decimal point is a must.  NO COMMAS negative must have - in front positive + is optional may use exponential notation example 337.456 = 3.37456E2= 0.337456E3= etc. 1.234 - yes  1,234 - no commas 56.0 - yes  63 - no decimal -56.0 - yes
Background image of page 7

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

View Full DocumentRight Arrow Icon
Data Types Character  - also called strings enclosed chars/strings in single quotes example 'A+B' length = 3 'help me' length = 7 includes the blank 'hello' length = 5 Double Precision  - very large numbers chapter 10 Complex  - imaginary numbers chapter 10 Logical  - boolean true or false chapter 3
Background image of page 8
  Identifiers Identifiers
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

Chapter2 - 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