Download presentation
Presentation is loading. Please wait.
Published byBritton Richards Modified over 9 years ago
1
Intro to Programming Logic and Design CIS 115 Brought to you by: done by Angela Robinson for CSC 289
2
Table of Contents: Repetitive Statements Count Controlled Count Controlled For Loop For Loop Condition Controlled Condition Controlled While Loop While Loop Do-While Loop Do-While Loop Do-Until Loop Do-Until Loop Summary Review Summary Review done by Angela Robinson for CSC 289
3
Count Controlled You know exactly how many done by Angela Robinson for CSC 289 Table of Contents
4
done by Angela Robinson for CSC 289 Table of Contents Counter Variable 1. Initialize 2. Test 3. Increment/ decrement
5
For Loop done by Angela Robinson for CSC 289 Table of Contents For counter = min to max statement Etc. End For
6
Examples Set squeeze = 0 For second 0 to 3 set squeeze = 1; End For Set squeeze = 0 done by Angela Robinson for CSC 289 Table of Contents
7
done by Angela Robinson for CSC 289 Flow Chart Raptor
8
Condition Controlled When you don’t know how long done by Angela Robinson for CSC 289 Table of Contents
9
True Or False done by Angela Robinson for CSC 289 Boolean Expression One way or the other Table of Contents
10
Sentinels A special value that marks the end of a list of values done by Angela Robinson for CSC 289 Table of Contents
11
Three kinds done by Angela Robinson for CSC 289 Table of Contents While Do-While Do-Until
12
While Loop Do after checking done by Angela Robinson for CSC 289 Table of Contents
13
Pre-Test done by Angela Robinson for CSC 289 Table of Contents May not run at all While condition Then Statement Etc. End While
14
Examples While hover = "on" For second 0 to 3 set squeeze = 1 End For set squeeze = 0 set hover = "off" End While done by Angela Robinson for CSC 289 Table of Contents
15
done by Angela Robinson for CSC 289 Flow Chart Raptor
16
Do-While Loop Do before checking done by Angela Robinson for CSC 289 Table of Contents
17
Post-Test done by Angela Robinson for CSC 289 Table of Contents Runs at least once DO Statement Etc. While condition
18
Examples Do For second 0 to 3 set squeeze = 1 End For set squeeze = 0 set hover = "off" While hover = "on" done by Angela Robinson for CSC 289 Table of Contents
19
done by Angela Robinson for CSC 289 Flow Chart Raptor
20
Do-Until Loop Do before checking done by Angela Robinson for CSC 289 Table of Contents
21
Post-Test done by Angela Robinson for CSC 289 Table of Contents Runs at least once DO Statement Etc. Until condition
22
Examples Do For second 0 to 3 set squeeze = 1 End For set squeeze = 0 set hover = "off" Until hover = “off" done by Angela Robinson for CSC 289 Table of Contents
23
done by Angela Robinson for CSC 289 Flow Chart Raptor
24
Nested Statements The Matryoska dolls of programming done by Angela Robinson for CSC 289 Table of Contents
25
Infinite Loops The Energizer bunny of programs done by Angela Robinson for CSC 289 Table of Contents
26
Don’t Forget to change the status done by Angela Robinson for CSC 289 Too much work Table of Contents
27
Comments What are you doing? done by Angela Robinson for CSC 289 Table of Contents
28
Isn’t it obvious? Table of Contents
29
How to comment Single Line //this is a comment Multi-Line /* this is a *Multiline comment */ done by Angela Robinson for CSC 289 Table of Contents
30
Examples Do For second 0 to 3 set squeeze = 1//turn squeeze on End For set squeeze = 0 //turn squeeze off set hover = "off" Until hover = “off" done by Angela Robinson for CSC 289 Table of Contents
31
Lets Review A summary of what we have learned here done by Angela Robinson for CSC 289 Table of Contents
32
What is a Repetitive Statement? A statement that tells the program what to do until a condition is true or false. done by Angela Robinson for CSC 289 Table of Contents
33
What are the four repetitive statements? For Loop While Loop Do-While Loop Do-Until Loop done by Angela Robinson for CSC 289 Table of Contents
34
What is a sentinel? A special value that marks the end of a list of values done by Angela Robinson for CSC 289 Table of Contents
35
How do you make sure you don’t get an infinite loop? By changing the status of the condition. done by Angela Robinson for CSC 289 Table of Contents
36
How do you make a comment? //this is a single-line comment /* this is a *multi-line comment */ done by Angela Robinson for CSC 289 Table of Contents
37
Resources Clip art provided by either Microsoft or Click Art 400K of Borderbund Starting out with Programming logic & Design, second edition by Tony Gaddis Raptor Flowcharting Tool Video recorded with Cam Studio (www.camstudio.org)www.camstudio.org Video edited with Adobe Premiere (www.adobe.com)www.adobe.com done by Angela Robinson for CSC 289 Table of Contents
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.