Presentation is loading. Please wait.

Presentation is loading. Please wait.

A Simple Program CPSC 110 - Pascal Brent M. Dingle Texas A&M University 2001, 2002.

Similar presentations


Presentation on theme: "A Simple Program CPSC 110 - Pascal Brent M. Dingle Texas A&M University 2001, 2002."— Presentation transcript:

1 A Simple Program CPSC 110 - Pascal Brent M. Dingle Texas A&M University 2001, 2002

2 Topics to be seen Reserved Words and Identifiers Program Body

3 A Program PROGRAM HowdyAll; BEGIN writeln(‘Howdy all !’); END. Simple enough? But what does it mean?

4 The first line PROGRAM HowdyAll; This is the program heading or program declaration. It has 3 parts: the reserved word program the name of the program – an identifier and lastly a semicolon All Pascal programs begin with a line like this.

5 Reserved Words Some words have a predefined meaning in Pascal that cannot be changed – these words are called reserved words. Examples of Reserved words are: PROGRAM, BEGIN and END

6 Standard Identifiers Other words in Pascal have predefined meanings but their meaning can be changed – these words are called standard identifiers. An example of a standard identifier is: writeln

7 Case (In)Sensitivity Pascal does NOT care if you use capital letters in your words. To it the words: BEGIN, BegIN, and BeGin are all the same.

8 Program Body The reserved words BEGIN and END mark the body of the program you just saw, back several slides. Notice the period after the END. All Pascal programs will end that way.

9 Writeln writeln is a procedure in Pascal. It is pronounced write-line. Inside the parentheses of the writeln is a string. A string is marked at the beginning and end with single quote marks.

10 The program’s output When you compile and run the program you will see the below output on the screen (note you may have to go to the user screen to see it) Howdy all !

11 Strings Strings are sequences of characters you want the program to treat as one object. Usually strings are composed of letters, digits, punctuation marks, spaces, and other symbols from the keyboard.

12 String creation To create a string place single quote marks at the beginning and end of the characters that you wish to group together. The single quote marks are called delimiters.

13 String examples ‘Howdy all !’ ‘Purple People Eater’

14 The single quote in a string To place the single quote in a string you type the single quote twice. For example: ‘Purple People Eaters don’’t exist.’ Note that don’’t is using TWO single quotes – NOT a double quote.

15 End of A Simple Program


Download ppt "A Simple Program CPSC 110 - Pascal Brent M. Dingle Texas A&M University 2001, 2002."

Similar presentations


Ads by Google