HOMEWORK assigned August 26, 2004

 

 

 

 

What do you need to know to write/run a program in a new language?

 

 

Some answers to above questions

Basic Syntax

 

Variable names are all uppercase

Variable names limited to 6 characters (first required to be alphabetic rest

can be alphanumeric)

Variables names which begin w/ A-H and 0-Z are by default floating point or

 real variables

Variables which begin with I-N are by default integers

Early FORTRAN had no character variables

Could change default by saying “INTEGER apple”

FORTRAN had to be written in particular columns

          -Column 1 were comments

          -Column 2-5 held numeric labels

          -Column 6 reserved for continuation

          -Column 7 – 72for program statements

          -Column 72-80 reserved for numbering the cards (purely to

reassemble punch cards in order)

Spaces between variable names ignored i.e R E D is same as RED

 

What is the assignment operator

=

 

What does the program header statement look like

None

 

What kinds of conditional branches are there

Go to 10  -  unconditional branch

If statement – discussed in class

          IF (X .LE. 5.3) Y = 23

 

Computed go to 

go(10, 12, 16, 18, 197, 6)I

          If I has value of 1, goes to first number and so forth

 

Arithmetic if 

          If(J) 10, 144, 367

          3 way branch- J<0 goes first number, J=0 goes to 2nd number, J>0

goes to 3rd number

 

 

What kinds of loop statements are there

            Essentially only had for loop

            Do 10 x = 1, 15, 3

c          (coding)

 10       continue

 

            sets x to 1, continues while x is less than 15 and is incremented by 3

 

What arithmetic operators are there?

*, **, +, -

SQRT(), IFIX(), etc

 

How do you terminate the program

Stop (can be written anywhere and stops program at this point)

End (marks end of code where compiler stops)