INF 165 Delphi - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

INF 165 Delphi

Description:

Accumulator and Flag variables. Ordinal Routines. Repetition - FOR loops ... Indeterminate (or indefinite) loop structure. Repetition While loop. Is condition ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 16
Provided by: gle108
Category:

less

Transcript and Presenter's Notes

Title: INF 165 Delphi


1
INF 165 - Delphi
  • Lecture 8

2
Class Outcomes
  • Repetition Structures
  • FOR loop
  • WHILE loop
  • REPEAT loop
  • Accumulator and Flag variables
  • Ordinal Routines

3
Repetition - FOR loops
Determinate (or definite) loop structure
for counter start to finish do begin
statements end
for counter start downto finish do begin
statements end
4
Repetition - FOR loops
counter start
Is counter gt finish
Yes
Continue with the code
No
Body of loop
Increment counter
5
Repetition - FOR loops
var counter integer sum
integer begin sum 0 for counter 1 to
100 do begin sum sum counter
end end
6
Repetition While loop
Indeterminate (or indefinite) loop structure
while condition do begin
statements end
7
Repetition While loop
Is condition True?
Yes
Continue with the code
No
Body of loop
8
Repetition While loop
sum 0 count 1 while (count lt 100) do
begin sum sum count count count
1 end
If count is not incremented it will result in an
endless loop.
9
Repetition Repeat loop
Indeterminate (or indefinite) loop structure
repeat statements until condition
10
Repetition Repeat loop
Body of loop
Is condition True?
Yes
Continue with the code
No
11
Repetition Repeat loop
sum 0 count 1 repeat sum sum
count count count 1 until (count gt
100)
If count is not incremented it will result in an
endless loop.
12
Flag variables
  • A Flag is a variable (typically a Boolean
    variable) that indicates the presence (or
    absence) of a condition.

var myStop boolean repeat
ShowMessage(hello world) myStop
cbxStop.checked until myStop
13
Ordinal Values
  • Ordinal types include integer, character,
    Boolean, enumerated, and sub-range types.
  • An ordinal type defines an ordered set of values
    in which each value except the first has a unique
    predecessor and each value except the last has a
    unique successor.
  • Further, each value has an order, which
    determines the ordering of the type.

14
Ordinal Routines
15
Ordinal Routines
Write a Comment
User Comments (0)
About PowerShow.com