7
Pseudo Code Brendan Coulson http://users.csc.calpoly.edu/~jdal bey/SWE/pdl_std.html [Accessed: 19/05/2011]

Pseudo Code

Embed Size (px)

DESCRIPTION

Pseudo Code. Brendan Coulson http://users.csc.calpoly.edu/~jdalbey/SWE/pdl_std.html [Accessed: 19/05/2011]. Pseudo Code - Continued. Pseudo code consists of short, English phrases used to explain specific tasks within a program's algorithm. - PowerPoint PPT Presentation

Citation preview

Page 1: Pseudo Code

Pseudo Code

Brendan Coulson

http://users.csc.calpoly.edu/~jdalbey/SWE/pdl_std.html [Accessed: 19/05/2011]

Page 2: Pseudo Code

Pseudo Code - Continued

Pseudo code consists of short, English phrases used to explain specific tasks within a program's algorithm.

Pseudo code is structured English that outlines the logic and structure of program code without being concerned with the exact syntax.

Process descriptor

Page 3: Pseudo Code

Pseudo Code - Continued

It has been proven that three basic constructs for flow of control are sufficient to implement any "proper" algorithm.

SEQUENCE is a linear progression where one task is performed sequentially after another.

WHILE is a loop (repetition) with a simple conditional test at its beginning.

IF-THEN-ELSE is a decision (selection) in which a choice is made between two alternative courses of action.

Key words should be CAPITALISED

Page 4: Pseudo Code

Pseudo Code - Examples

SEQUENCEExampleREAD height of rectangle READ width of rectangle COMPUTE area as height times width

Common Action KeywordsSeveral keywords are often used to indicate common input, output, andprocessing operations.

Input: READ, OBTAIN, GET Output: PRINT, DISPLAY, SHOW Compute: COMPUTE, CALCULATE, DETERMINE Initialize: SET, INIT Add one: INCREMENT, BUMP

Page 5: Pseudo Code

Pseudo Code - Examples

SELECTION

IF HoursWorked > NormalMax THEN

DISPLAY overtime message

ELSE

DISPLAY regular time message

ENDIF

Page 6: Pseudo Code

Pseudo Code - Examples

WHILEWHILE i < x

x = X + iINCREMENT i

END WHILE

Page 7: Pseudo Code

Pseudo Code

You try some examples

Add OrdersRemove Orders