Chapter3 - Chapter 3 THE MINIMAL PROGRAM In this chapter we...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 3 THE MINIMAL PROGRAM In this chapter we will introduce the minimum number of elements of programming that you need in order to begin to program. Nothing very important will be programmed but you will be able to go through the motions of writing a complete program and enter the program into a com- puter using the command language of the operating system and have it executed. Also you will see what kind of output to expect. Things will happen, though what the computer is actually doing for you will not be very exciting yet. But remember you will go through the same motions as are necessary when your programs do have more content. BASIC SYMBOLS OF THE FORTRAN LANGUAGE We will be presenting the programming language Fortran a little bit at a time. Any language consists of words and the words are made up of symbols that we call characters. These characters are put together in strings. In English the word elephant is a string of characters of length eight. It contains only seven different characters, the character e being used twice. We can tell that it is a word because it has a blank in front of it and one at the end. In a way the blank is also a character, but a special character for separating words. We sometimes denote the blank by b when we show programs in this book so that you can see how many blanks are present. In English, we group words into sentences and we can tell the end of a sentence because of a special mark, the period. We also have a different kind of sentence that ends with a question mark, don't we? In addition to periods and question marks, we have other punctuation marks which serve to make sentences in the language easier to read. They also serve to
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 | THE MINIMAL PROGRAM remove ambiguity in a sentence. There is some doubt about the meaning of the sentence The student claims the teacher understands. The doubt is removed if it is written with commas, as, The student, claims the teacher, understands. It is important that statements in a programming language be unambiguous , so punctuation is used a great deal. Instead of a sentence, the basic unit in the main part of a program is a statement . Statements are separated from each other by starting each statement on a new line for input. In some other high-level languages, statements are separated by having a semicolon between them. This serves to separate them just as periods separate sentences in English. In most high-level languages the comma is used to separate items in any list of similar items, and parentheses are used to enclose things that belong together. We will have words in Fortran that are made up of letters of the alphabet and might also have digits in them. Although there are definite rules governing the way that Fortran statements are formed, we want them to be understandable. This means the words should be like English words. We use words like
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/13/2012 for the course CSE 1540 taught by Professor Hofbauer during the Winter '12 term at York University.

Page1 / 13

Chapter3 - Chapter 3 THE MINIMAL PROGRAM In this chapter we...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online