Lecture 4

 

Library functions:   SQRT,  SIN, COS, ABS, IABS, IFIX, FLOAT  - look for one for random numbers 

 

FORTRAN identifiers were (and thus should be) limited to 6 characters

 

Test to see what happens if your output format is inadequate or too large *****

 

DO loop  - original FORTRAN was always executed at least once --- in FORTRAN 77, it tested the starting value against the ending value

                   Exits when current value of loop control variable is greater than ending value

 

Arrays in standard FORTRAN has 1 as the lowest subscript

 

Order of operations (highest precedence to lowest) is

   Library functions

   **   exponentiation

   *    /  

   + - 

  Having parentheses can change order of operations

 

Results of integer division

 

Don’t use if (condition) …. End if  or any else statements  -- added in FORTRAN 77

 

Author’s slides for Chapter 3 (relates to handout from class which is to be discussed next time)

 

Student  code examples

            factorial

            fibonacci

            guessingGame

            textPlay

           

In-Class Professor examples

            myChar   - does what textPlay wanted to do

            myChar1v2 -  shows that can’t hold more than 4 characters in a word

            myChar1v3 -  adds lines to myChar1v2 to read individual characters

            myFormat  - shows problems that can occur with output FORMAT statements

            m1 – shows 3 ways of reading in 10 integers into an array  - shows implied DO loop

            source7 – shows use of  FLOAT function to force real division to occur and then assigns real result to an integer

 

There may have been other short in-class examples but what they illustrate is covered in one of the above examples.