lecture-2 notes .doc

4 Pages
Unlock Document

Electrical Engineering and Computer Science
EECS 1540
All Professors

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. Control Statements Read: Chapter 3 and 4 of the textbook. - determine order in which statements are executed: repetition, selection Prerequisite for success in Computer Programming: ⇒ the game of "musical buckets" Comments 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 Program Structure 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: program Convert implicit none Fortran Program Components ! read Fahrenheit temperature and Program Units ! print corresponding Celsius value main program, subprograms (functions, subroutines) real f,c Declaration Statements read*, f c = 5 * (f - 32) / 9 provide names and attributes of variables set aside space the "buckets" print*, c end CSE 1540 Week 2.2 – September 14, 2011 page 1 of 4 Notes: Example: 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 statement. Declarations 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. Analogy: "buckets" 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)
More Less

Related notes for EECS 1540

Log In


Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.