Week 11 Recap CSE 115 Spring 2007. Want to write a programming language? You’ll need three things: You’ll need three things: –Sequencing –Selection Polymorphism.

Slides:



Advertisements
Similar presentations
Introduction to C Programming
Advertisements

Repetition Statements Perform the same task repeatedly Allow the computer to do the tedious, boring things.
Programming In C++ Spring Semester 2013 Lecture 3 Programming In C++, Lecture 3 By Umer Rana.
While loops.
CS 101 Introductory Programming - Lecture 7: Loops In C & Good Coding Practices Presenter: Ankur Chattopadhyay.
Do-while Loops Programming. COMP102 Prog Fundamentals I: do-while Loops /Slide 2 The do-while Statement l Syntax do action while (condition) l How it.
CHAPTER 5: Repetition Control Structure. Objectives  To develop algorithms that use DOWHILE and REPEAT.. UNTIL structures  Introduce a pseudocode for.
Executes a statement or statements for a number of times – iteration. Syntax for(initialize; test; increment) { // statements to be executed } Initial.
CSE 115 Week 11 March , Announcements March 26 – Exam 7 March 26 – Exam 7 March 28 – Resign Deadline March 28 – Resign Deadline Lab 7 turned.
Week 10 Recap CSE 115 Spring For-each loop When we have a collection and want to do something to all elements of that collection we use the for-each.
6. More on the For-Loop Using the Count Variable Developing For-Loop Solutions.
Repetition Statements repeat block of code until a condition is satisfied also called loops Java supports 3 kinds of loops: while statement – repeats a.
CSE 115 Week 12 March 31 – April 4, Announcements March 31 – Exam 8 March 31 – Exam 8 April 6 – Last day to turn in Lab 7 for a max grade of 100%,
Computer Programming 1 Repetition. Computer Programming 2 Objectives Repetition structures Study while and do loops Examine for loops A practical example.
CSE 113 Week 5 February , Announcements  Module 2 due 2/15  Exam 3 is on 2/15  Module 3 due 2/22  Exam 4 is on 2/25  Module 4 due 2/29.
Loops Repetition Statements. Repetition statements allow us to execute a statement multiple times Often they are referred to as loops Like conditional.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved The switch Multiple-Selection Statement switch.
11 Chapter 4 LOOPS AND FILES. 22 THE INCREMENT AND DECREMENT OPERATORS To increment a variable means to increase its value by one. To decrement a variable.
Flow of Control. 2 Control Structures Control structure: An instruction that determines the order in which other instructions in a program are executed.
Lecture Set 5 Control Structures Part D - Repetition with Loops.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
CPS120 Introduction to Computer Science Iteration (Looping)
REPETITION CITS1001. Scope of this lecture Repetition for loops while loops 2.
For Loop Lesson 1 CS1313 Spring for Loop Lesson 1 Outline 1. for Loop Lesson 1 Outline 2.A while Loop That Counts #1 3.A while Loop That Counts.
ㅎㅎ logical operator if if else switch while do while for Third step for Learning C++ Programming Repetition Control Structures.
COMPUTER PROGRAMMING. Iteration structures (loops) There may be a situation when you need to execute a block of code several number of times. In general,
Saeed Ghanbartehrani Summer 2015 Lecture Notes #5: Programming Structures IE 212: Computational Methods for Industrial Engineering.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Flow Control (for) Outline 4.1Introduction 4.2The.
February ,  2/16: Exam 1 Makeup Papers Available  2/20: Exam 2 Review Sheet Available in Lecture  2/27: Lab 2 due by 11:59:59pm  3/2:
Pascal Programming Iteration (looping) Carl Smith National Certificate Unit 4.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
CPS120 Introduction to Computer Science Iteration (Looping)
The while-statement. The loop statements in Java What is a loop-statement: A loop-statement is a statement that repeatedly executes statements contained.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
Repetition Control Structure. Introduction Many applications require certain operations to be carried out more than once. Such situations require repetition.
Structured Programming The Basics. Control structures They control the order of execution What order statements will be done in, or whether they will.
Think Possibility 1 Iterative Constructs ITERATION / LOOPS C provides three loop structures: the for-loop, the while-loop, and the do-while-loop. Each.
Repetition Statements (Loops). 2 Introduction to Loops We all know that much of the work a computer does is repeated many times. When a program repeats.
Chapter 7: The Repetition Structure Introduction to Programming with C++ Fourth Edition.
Copyright 2006 Addison-Wesley Brief Version of Starting Out with C++ Chapter 5 Looping.
While loops. Iteration We’ve seen many places where repetition is necessary in a problem. We’ve been using the for loop for that purpose For loops are.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
Loops Tonga Institute of Higher Education. Introduction Programs need to be able to execute tasks repeatedly. Use loops to repeat actions  For Loop 
Conditional Statements A conditional statement lets us choose which statement will be executed next Conditional statements give us the power to make basic.
Loops causes program to execute the certain block of code repeatedly until some conditions are satisfied. Suppose you want to execute some code/s 10 times.
Follow up from lab See Magic8Ball.java Issues that you ran into.
PHP Condtions and Loops Prepared by Dr. Maher Abuhamdeh.
Lecture 6 Repetition Richard Gesick.
Loops in Java.
Lesson 05: Iterations Class Chat: Attendance: Participation
for Loop 1 Outline for Loop 1 Outline for Loop
Think What will be the output?
Chapter 5 Structures.
Logical Operators and While Loops
Arrays, For loop While loop Do while loop
Lesson 05: Iterations Topic: Introduction to Programming, Zybook Ch 4, P4E Ch 5. Slides on website.
Lecture Notes – Week 3 Lecture-2
Collections & Definite Loops
Chapter 6: Repetition Statements
Loop Strategies Repetition Playbook.
Case & Repetitive Statements
Flow of Control.
If-statements & Indefinite Loops
Seating “chart” Front - Screen rows Back DOOR.
Repetition Statements (Loops) - 2
PROGRAM FLOWCHART Iteration Statements.
Statements in C Programming
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.
LOOPING STRUCTURE Chapter - 7 Padasalai
Presentation transcript:

Week 11 Recap CSE 115 Spring 2007

Want to write a programming language? You’ll need three things: You’ll need three things: –Sequencing –Selection Polymorphism Polymorphism If-statements If-statements –Repetition For-each loop (only useful on collections) For-each loop (only useful on collections) For-loop For-loop While-loop While-loop Do-while-loop Do-while-loop

For-loop Definite loop / Counting loop – has things built into it to make it easier to count the number of times the loop has executed Definite loop / Counting loop – has things built into it to make it easier to count the number of times the loop has executed Entry-test loop – determining whether to continue looping is determined before the loop body is run. Entry-test loop – determining whether to continue looping is determined before the loop body is run.

For-loop Syntax for(initialization; boolean expression; increment){ //code to be repeated }Where: initialization – (typically) creates a variable for the loop counter and sets its initial value boolean expression – (typically) checks the bounds on the loop counter increment – (typically) increments the value of the loop counter after each iteration of the loop

While loop Indefinite loop – Will continue to execute until the expression is false – no mechanism built it for prescribing a particular number of iterations. Indefinite loop – Will continue to execute until the expression is false – no mechanism built it for prescribing a particular number of iterations. Entry-test loop Entry-test loop

While loop while(boolean expression) { //code to execute repeatedly } Where: Where: –Boolean expression is the expression to be evaluated to indicate the end of the repetition. As long as the expression is true, keep looping.

Building a System  We are going to spend the rest of the semester building a larger project from scratch.  Please see slides about building our game of memory.