CSE 1540.03 Executable Statements
Week 2.2 (no Week 2.1) September 14, 2011 Manipulative Statements
- manipulate values of variables (do work):
assignment statements, input, etc.
Read: Chapter 3 and 4 of the textbook. - determine order in which statements are executed:
Prerequisite for success in Computer Programming: ⇒ the game of "musical buckets"
Donald Knuth (perhaps the worldth foremost Computer Scientist) put it - make program easier to understand for humans
best in a keynote address for the 11 World Computer Congress in
1989: - have NO effect on program or computer
"What were the lessons I learned from so many years of intensive
work on the practical problem of setting type by computer? One of
the most important lessons, perhaps, is the fact that SOFTWARE IS
HARD. From now on I shall have significantly greater respect for program name
every successful software tool that I encounteDuring the past
decade I was surprised to learn that the writing of programs for TeX implicit none
and METAFONT proved to be much more difficult than all other declarations
things I had done (like proving theorems or writing books). The executable statements
creation of good software demands a significantly higher standard of end
accuracy than those other things do, and it requires a longer attention
span than other intellectual tasks." Example:
Fortran Program Components
! read Fahrenheit temperature and
Program Units ! print corresponding Celsius value
main program, subprograms (functions, subroutines)
Declaration Statements read*, f
c = 5 * (f - 32) / 9
provide names and attributes of variables
set aside space the "buckets" print*, c
CSE 1540 Week 2.2 – September 14, 2011 page 1 of 4 Notes:
1. By convention, lower case is used for everything except named
constants, which are in upper case. It is generally accepted that ! This is a long comment
lower case looks more attractive. ! which stretches over
! several lines
2. Comments are placed on a separate line.
3. All variables must be declared before the first executable
integer list of variables
4. Fortran 77 is line oriented. (Avoid using the first column.)
to continue a line, end the existing line with & and start real list of variables
the next line with an &.
A separator is a i) space (blank) Notes:
ii) tab 1. set aside space in the computer's memory to store data.
2. attach a name to this space.
Identifiers (i.e. variable names), keywords, constants, etc. may
not contain a separator.
5. The listing appears as it was entered, so paragraphing is the variable = bucket + label stuck to its front
programmer's responsibility. label = identifier (variable name)