Chapter 1: An Introduction to Control Structures Introduction to Programming with C++ Fourth Edition.

Slides:



Advertisements
Similar presentations
CS101: Introduction to Computer programming
Advertisements

Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 9 Decisions, Decisions, Decisions.
Defining Control Structures
An Introduction to Programming with C++ Fifth Edition Chapter 1 An Introduction to Programming.
Chapter 3 Planning Your Solution
Tell the robot exactly how to draw a square on the board.
Computer Programming TCP1224 Chapter 2 Beginning the Problem-Solving Process.
An Introduction to Programming with C++ Sixth Edition
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
CPS120 Introduction to Computer Programming The Programming Process.
Pseudocode. Simple Program Design, Fourth Edition Chapter 2 2 Objectives In this chapter you will be able to: Introduce common words, keywords, and meaningful.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 2 I Am Not a Control Freak!
Control Structures CPS120: Introduction to Computer Science Lecture 5.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Pseudocode Algorithms Using Sequence, Selection, and Repetition Simple Program Design Third Edition A Step-by-Step Approach 6.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Overview An Introduction to Programming.
Program Design. The design process How do you go about writing a program? –It’s like many other things in life Understand the problem to be solved Develop.
Software. Computers can be used to control all sorts of devices: The device follows a sequence of instructions created by the software.
Chapter 7: The Repetition Structure Introduction to Programming with C++ Fourth Edition.
STEP 3- DEVELOP AN ALGORITHM At this stage we break down the problem into simple manageable steps so that they can be handled easily.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
An Introduction to Programming with C++1 An Introduction to Control Structures Tutorial 1.
Introduction to Programming in C++ Seventh Edition Chapter 1: An Introduction to Programming.
CPS120: Introduction to Computer Science
Program Design Introduction to Computer Programming By:
An Introduction to Control Structures
Chapter 1: Introduction
Global Challenge Fitness Friend Lesson 2.
Global Challenge Night Sensor Lesson 2.
Global Challenge Flashing Wheels Lesson 2.
Global Challenge Night Sensor Lesson 2.
Global Challenge Night Sensor Lesson 2.
Global Challenge Night Sensor Lesson 2.
Global Challenge Fitness Friend Lesson 2.
Global Challenge Night Sensor Lesson 2.
Global Challenge Flashing Wheels Lesson 2.
Early - I can develop a sequence of instructions and run them using programmable devices or equivalent Designs a simple sequence of instructions/algorithm.
Global Challenge Walking for Water Lesson 2.
Global Challenge Night Sensor Lesson 2.
Global Challenge Fitness Friend Lesson 2.
Global Challenge Fitness Friend Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
An Introduction to Control Structures
Global Challenge Night Sensor Lesson 2.
Global Challenge Fitness Friend Lesson 2.
Global Challenge Night Sensor Lesson 2.
Global Challenge Fitness Friend Lesson 2.
Global Challenge Night Sensor Lesson 2.
An Introduction to Programming with C++ Fifth Edition
Global Challenge Flashing Wheels Lesson 2.
Global Challenge Fitness Friend Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Flashing Wheels Lesson 2.
Global Challenge Flashing Wheels Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Night Sensor Lesson 2.
Global Challenge Flashing Wheels Lesson 2.
Global Challenge Night Sensor Lesson 2.
Global Challenge Flashing Wheels Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Flashing Wheels Lesson 2.
Global Challenge Fitness Friend Lesson 2.
Global Challenge Flashing Wheels Lesson 2.
Global Challenge Flashing Wheels Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Nate Brunelle Today: Pseudo-Code
Presentation transcript:

Chapter 1: An Introduction to Control Structures Introduction to Programming with C++ Fourth Edition

Introduction to Programming with C++, Fourth Edition 2 Objectives Explain the sequence, selection, and repetition structures Write simple algorithms using the sequence, selection, and repetition structures

Introduction to Programming with C++, Fourth Edition 3 Defining Control Structures All computer programs, no matter how simple or how complex, are written using one or more of three basic structures: –Sequence –Selection –Repetition

Introduction to Programming with C++, Fourth Edition 4 The Sequence Structure Directs the computer to process the program instructions, one after another, in the order listed in the program Rob, the mechanical man, has a limited instruction set (walk, turn, and sit)

Introduction to Programming with C++, Fourth Edition 5 The Sequence Structure

Introduction to Programming with C++, Fourth Edition 6 The Repetition Structure Makes a decision, then takes appropriate action based on that decision –Example: shampoo bottles typically include the repetition structure in the directions for washing your hair

Introduction to Programming with C++, Fourth Edition 7 The Repetition Structure

Introduction to Programming with C++, Fourth Edition 8 The Repetition Structure

Introduction to Programming with C++, Fourth Edition 9 Rob’s New Instruction Set

Introduction to Programming with C++, Fourth Edition 10 The Selection Structure Directs the computer to repeat one or more instructions until some condition is met, at which time the computer should stop repeating the instructions –Example: Selection structure is used every time you drive your car and approach an intersection

Introduction to Programming with C++, Fourth Edition 11 The Selection Structure (continued)

Introduction to Programming with C++, Fourth Edition 12 Summary Basic components of all algorithmic problem solutions: –Sequence Process instructions one after another –Selection Take an action based on a decision –Repetition Repeat a set of instructions until a condition is met Write simple algorithms using the sequence, selection, and repetition structures