Looping Structures. A B dialog box that pops up and prompts the user for input Text area that pops up and prompts the user for to wait while it gets.

Slides:



Advertisements
Similar presentations
Computer Science 101 While Statement. Iteration: The While-Statement The syntax for the While- Statement is while : The syntax for the While- Statement.
Advertisements

Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
CS0004: Introduction to Programming Repetition – Do Loops.
Visual Basic.NET BASICS Lesson 10 Do Loops. 2 Objectives Explain what a loop is. Use the Do While and Do Until loops. Use the InputBox function. Use the.
Repeating Actions While and For Loops
Do/Loops A loop repeats a series of instructions. An iteration is a single execution of the statement(s) in the loop. Used when the exact number of iterations.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 5 Looping.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition Chapter 5: Looping by Tony.
Iteration (Looping Constructs in VB) Iteration: Groups of statements which are repeatedly executed until a certain test is satisfied Carrying out Iteration.
Do Loops A Do..Loop terminates based on a condition that is specified Execution of a Do..Loop continues while a condition is True or until a condition.
An Introduction to Programming with C++ Fifth Edition
1 Loops Loops repeat (iterate) a block of statements for a number of times. A terminating condition tells a loop when to stop iterating (e.g. terminate.
1 Pertemuan 06 Repetition Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
Repeating Program Instructions Chapter Microsoft Visual Basic.NET: Reloaded 1.
5.05 Apply Looping Structures
Chapter 5 new The Do…Loop Statement
CHAPTER SIX Loop Structures.
CHAPTER 6 Loop Structures.
Repetition Statements Repeating an Action A specified number of times While a Condition is True Until a Condition is True.
Intrinsic Functions Pre-coded Functions Used to improve developer productivity Broad Range of Activities Math calculations Time/Date functions String.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Six Repeating Program Instructions.
1 Chapter 6 – Repetition 6.1 Do Loops 6.2 For...Next Loops 6.3 List Boxes and Loops.
 What are the different types of loops? ◦ Do….While  Performs statements within loop while a condition is true ◦ Do….Until  Performs statements within.
CIS 115 Lecture 8. There are 3 control structures common to most computer languages that determine the flow, or path of execution, of the code:  Sequential.
Chapter 12: How Long Can This Go On?
For Loops 1 Loops/Iteration Used to repeat an action Must have a STOP condition Three flavors - for, while, do/while Which loop to use? task with a specific.
1 Week 6 The Repetition Structure. 2 The Repetition Structure (Looping) Lesson A Objectives After completing this lesson, you will be able to:  Code.
© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 8: Chapter 5: Slide 1 Unit 8 List Boxes and the Do While Looping Structure.
Statements That Repeat. For...Next Loop Structure For counter = start To end Step increment statements Next counter Where Counter is tested to see if.
COMPUTER PROGRAMMING I 5.05 Apply Looping Structures.
Tutorial 6 The Repetition Structure
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter Six The Do Loop and List Boxes.
COMPUTER PROGRAMMING I 5.05 Apply Looping Structures.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 5 Looping.
+ Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy Walters, and Godfrey Muganda Chapter 5: Looping.
Chapter 7 - Lists, loops and printing w List boxes and combo boxes several types can add items at design time or during run time user select from predefined.
Looping Structures Do Loops, For Next Do...Loop While structures check the condition after executing the code and repeat a code block until the test.
1 Standard Version of Starting Out with C++, 4th Brief Edition Chapter 5 Looping.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5: Looping.
Chapter 6 Looping Structures. Do…LoopDo…Loop Statement Can operate statements repetitively Do intx=intx + 1 Loop While intx < 10 –The Loop While operates.
7-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Copyright © 2012 Pearson Education, Inc. Chapter 5: Loops.
Tutorial 6: The Repetition Structure1 Tutorial 6 The Repetition Structure.
© 2006 Lawrenceville Press Slide 1 Chapter 6 The Post-Test Do…Loop Statement  Loop structure that executes a set of statements as long as a condition.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 13 How Long Can This Go On?
Controlling Program Flow with Looping Structures
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 5 Looping.
Chapter Looping 5. The Increment and Decrement Operators 5.1.
Input Boxes, List Boxes, and Loops Chapter 5. 2 Input Boxes Method for getting user’s attention to obtain input. InputBox() for obtaining input MessageBox()
Copyright 2006 Addison-Wesley Brief Version of Starting Out with C++ Chapter 5 Looping.
Chapter Looping 5. The Increment and Decrement Operators 5.1.
COMPUTER PROGRAMMING I 5.05 Apply Looping Structures.
Chapter 6 Controlling Program Flow with Looping Structures.
© 2010 Lawrenceville Press Slide 1 Chapter 5 The Do…Loop Statement  Loop structure that executes a set of statements as long as a condition is true. 
UNIT 5 Lesson 15 Looping.
Controlling Program Flow with Looping Structures
Lists, Loops, Validation, and More
Chapter 5: Looping Starting Out with C++ Early Objects Seventh Edition
Repeating Program Instructions
Chapter 6 – Repetition 6.1 Do Loops 6.2 For...Next Loops
Chapter 5 The Do…Loop Statement
Microsoft Visual Basic 2005: Reloaded Second Edition
حلقات التكرار.
Alternate Version of STARTING OUT WITH C++ 4th Edition
Higher Computing Using Loops.
Algorithms Take a look at the worksheet. What do we already know, and what will we have to learn in this term?
CIS 16 Application Development Programming with Visual Basic
Alternate Version of STARTING OUT WITH C++ 4th Edition
LOOPS The loop is the control structure we use to specify that a statement or group of statements is to be repeatedly executed. Java provides three kinds.
Presentation transcript:

Looping Structures

A B dialog box that pops up and prompts the user for input Text area that pops up and prompts the user for to wait while it gets input

A B dialog box that pops up and prompts the user for input Text area that pops up and prompts the user for to wait while it gets input

A B ix

A B ix

A. B. Keeping the loop running Keeping a running total

A. B. Keeping the loop running Keeping a running total

A. B. Do While Do…Loop While For…Next For Each…Next Do While Do…Loop While For…Next Do For …Next

A. B. Do While Do…Loop While For…Next For Each…Next Do While Do…Loop While For…Next Do For …Next

A. B. Test the condition BEFORE the loop runs. If the condition is false the loop will not execute. Run the loop one time then test the condition- if the condition is false the loop will then terminate

A. B. Test the condition BEFORE the loop runs. If the condition is false the loop will not execute. Run the loop one time then test the condition- if the condition is false the loop will then terminate

A. B. Do While condition Statements Loop Do condition Statements Loop While

A. B. Do While condition Statements Loop Do condition Statements Loop While

A. B. when you know how many times the loop will run when a variable is used in the condition.

A. B. when you know how many times the loop will run when a variable is used in the condition.

A. B. StrVariable = InputBox (prompt, title) StrVariable = InputBox “prompt, title”

A. B. StrVariable = InputBox (prompt, title) StrVariable = InputBox “prompt, title”

A. B. the value that updates the accumulator changes It adds up all values

A. B. the value that updates the accumulator changes It adds up all values

A. B. CirclesRepeated actions

A. B. CirclesRepeated actions

A. B. Pretest and Prosttest Pretest and Protest

A. B. Pretest and Prosttest Pretest and Protest

A. B. FalseTrue

A. B. FalseTrue

A. B. Do Statements Loop While condition Do Statements Loop (condition)

A. B. Do Statements Loop While condition Do Statements Loop (condition)

A. B. when a variable is used in the condition when you know how many times the loop will run

A. B. when a variable is used in the condition when you know how many times the loop will run

A. counter variable B. Accumulator Variable

A. counter variable B. Accumulator Variable

A. accumulator = accumulator + value accumulator += value B. accumulator = accumulator + variable accumulator += variable

A. accumulator = accumulator + value accumulator += value B. accumulator = accumulator + variable accumulator += variable

A. Every time the loop returns to the top B. Each time the loop runs

A. Every time the loop returns to the top B. Each time the loop runs

A. Test the condition BEFORE the loop runs. If the condition is false the loop will not execute. B. Run the loop one time then test the condition- if the condition is false the loop will then terminate

A. Test the condition BEFORE the loop runs. If the condition is false the loop will not execute. B. Run the loop one time then test the condition- if the condition is false the loop will then terminate

A. NEVER B. ALWAYS

A. NEVER B. ALWAYS

A. For counter = start To end Statements Next counter B. For counter = start To end Statements loop

A. For counter = start To end Statements Next counter B. For counter = start To end Statements loop

A. A condition used to signify that a loop should stop executing B. A condition used to signify that a loop should continue to execute

A. A condition used to signify that a loop should stop executing B. A condition used to signify that a loop should continue to execute