Wrapup which is the document write that says the end.

Slides:



Advertisements
Similar presentations
Playing computer with logic problems Please use speaker notes for additional information!
Advertisements

CHAPTER 5: Repetition Control Structure. Objectives  To develop algorithms that use DOWHILE and REPEAT.. UNTIL structures  Introduce a pseudocode for.
Loops (Part 1) Computer Science Erwin High School Fall 2014.
1 Repetition structures Overview while statement for statement do while statement.
Loops Repetition Statements. Repetition statements allow us to execute a statement multiple times Often they are referred to as loops Like conditional.
© 2004 Pearson Addison-Wesley. All rights reserved5-1 Iterations/ Loops The while Statement Other Repetition Statements.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Engineering 1020 Introduction to Programming Peter King Winter 2010.
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.
Logic Structure - focus on looping Please use speaker notes for additional information!
When you start a new world, pick a backgrou nd.. Click on add objects to add objects to your world.
Array - adding to array at run time Please see speaker notes for additional information!
Programming Logic and Design Fourth Edition, Comprehensive Chapter 6 Looping.
Chapter 5: Structured Programming
Variety of JavaScript Examples Please use speaker notes for additional information!
Counter-Controlled Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Introduction to Loops For Loops. Motivation for Using Loops So far, everything we’ve done in MATLAB, you could probably do by hand: Mathematical operations.
JavaScript Loops Please use speaker notes for additional information!
Conditional Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
 for loop  while loop  do-while loop for (begin point; end point ; incrementation ) { //statements to be repeated }
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5: Looping.
Agenda Perform Quiz #1 (20 minutes) Loops –Introduction / Purpose –while loops Structure / Examples involving a while loop –do/while loops Structure /
Copyright © 2012 Pearson Education, Inc. Chapter 5: Loops.
ARITHMETIC OPERATORS COMPARISON/RELATIO NAL OPERATORS LOGIC OPERATORS ()Parenthesis>Greater than &&And ^Exponentiation=>=
Chapter Looping 5. The Increment and Decrement Operators 5.1.
ITEC 109 Lecture 18 Looping. Review Questions? Conditionals –if / elif / else –and / or / not.
CPSC 233 Tutorial 5 February 2 th /3 th, Java Loop Statements A portion of a program that repeats a statement or a group of statements is called.
Chapter Looping 5. The Increment and Decrement Operators 5.1.
Loop Blocks Chapter 6 Part A. Program Blocks 1.Actions- commands, messages, methods 2.Branches- decisions to be made 3.Loops- actions to be repeated.
Loops Tonga Institute of Higher Education. Introduction Programs need to be able to execute tasks repeatedly. Use loops to repeat actions  For Loop 
Learning Javascript From Mr Saem
This is a while loop. The code is done while the condition is true. The code that is done is enclosed in { }. Note that this program has three parts: Housekeeping.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. 4 Simple Flow of Control.
CHAPTER 4 DECISIONS & LOOPS
Chapter 5: Structured Programming
CSC111 Quick Revision.
Chapter 4 Repetition Statements (loops)
Programming Logic and Design Fourth Edition, Comprehensive
3rd prep. – 2nd Term MOE Book Questions.
Chapter 5: Looping Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
3rd prep. – 2nd Term MOE Book Questions.
While loops The while loop executes the statement over and over as long as the boolean expression is true. The expression is evaluated first, so the statement.
Chapter 4 LOOPS © Bobby Hoggard, Department of Computer Science, East Carolina University / These slides may not be used or duplicated without permission.
Iteration with While You can say that again.
Outline Altering flow of control Boolean expressions
Please use speaker notes for additional information!
Exam 1 Date: Feb. 2nd, 2015 during class time (50 minutes) Coverage
Chapter (3) - Looping Questions.
Higher Computing Using Loops.
Iteration: Beyond the Basic PERFORM
Iteration: Beyond the Basic PERFORM
Module 4 Loops.
Remembering lists of values lists
the captured notes and redid - hopefully it all works.
Searching an Array or Table
Using Lists and Functions to Create Dialogue
Note the rights settings.
The + can mean concatenate or add
Programs. at the code at the site..
A LESSON IN LOOPING What is a loop?
JavaScript: Control Statements II
Building Java Programs
Introduction to Programming with Python
Building Java Programs
Chapter 2 Lecture 2-2: The for Loop reading: 2.3
2 file sequential matching with multiple records allowed on file 2
If-Statements and If/Else Statements
This is an introduction to JavaScript using the examples found at the CIS17 website. In previous examples I specified language = Javascript, instead of.
Module 4 Loops and Repetition 9/19/2019 CSE 1321 Module 4.
Presentation transcript:

Wrapup which is the document write that says the end.

This loop has three requirements to control processing This loop has three requirements to control processing. I iniitialize ct at 1, inside the loop I increment ct by 1 so it will change and the processing is controlled with a test or condition that compares ct to data_input. Since ct is constantly incrementing, eventually it will not be <= to data_input and the loop will stop.

This time I entered 1 for data_input so it processed once while the ct of 1 was = data_input of 1.

This time I entered 0 as the data_input so no processing was done in the while loop. The comparison compared ct which was 1 to data_input which was 0 and ct was not less than or equal to data_input.

This is the do loop with the condition at the end This is the do loop with the condition at the end. Therefore it is always executed once. I take in data_input, I set ct = 1 and then I enter the loop and write out a line and increment ct. Then I compare to see if I should do the loop again. At this point ct is 2 and data_input is the 6 that I entered, so the loop is done again.

Note that If I entered a 0 I would get the same result because it would process once and then ct would be 2 and data_input would be 0 so it would not process again.

Processing does the loop multiple times. Wrapup is executed once when processing is complete. I check the total_Points and determine the message.

This prints out the total for each player as long as the user enters Y to continue. Any other entry would end the loop.

In class work was to add an if statement to tell which player won or if it was a tie.

example for sample if.