Basic Building Blocks of Programming. Variables and Assignment Think of a variable as an empty container Assignment symbol (=) means putting a value into.

Slides:



Advertisements
Similar presentations
Nested if-else Statements.  Should be indented to make the logic clear.  Nested statement executed only when the branch it is in is executed. For example,
Advertisements

ALGORITHMS - PART 2 CONDITIONAL BRANCH CONTROL STRUCTURE
CHAPTER 5: Repetition Control Structure. Objectives  To develop algorithms that use DOWHILE and REPEAT.. UNTIL structures  Introduce a pseudocode for.
Understanding the Three Basic Structures
Introduction to Flowcharting
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 9 Decisions, Decisions, Decisions.
Chapter 4 Control Structures I. Objectives ► Examine relational and logical operators ► Explore how to form and evaluate logical (Boolean) expressions.
REPETITION (loops or iteration) Schneider: Sec. 6.1 & 6.3.
Chapter 5: Control Structures II (Repetition)
Chapter 5: Control Structures II (Repetition)
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand basic loop concepts: ■ pretest loops and post-test loops ■ loop.
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
1 Chapter 4 Simple Selections and Repetitions INTRODUCTION The majority of challenging and interesting algorithms necessitate the ability to make.
C How to Program, 6/e Summary © by Pearson Education, Inc. All Rights Reserved.
True or False Unit 3 Lesson 7 Building Blocks of Decision Making With Additions & Modifications by Mr. Dave Clausen True or False.
The University of Texas – Pan American
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Lecture Set 5 Control Structures Part D - Repetition with Loops.
Selection Programming EE 100. Outline introduction Relational and Logical Operators Flow Control Loops Update Processes.
Project 1 Due Date: September 25 th Quiz 4 is due September 28 th Quiz 5 is due October2th 1.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Chapter 2 Pseudocode. Objectives To introduce common words, keywords and meaningful names when writing pseudocode To define the three basic control structures.
Pseudocode. Simple Program Design, Fourth Edition Chapter 2 2 Objectives In this chapter you will be able to: Introduce common words, keywords, and meaningful.
Pseudocode Simple Program Design Third Edition A Step-by-Step Approach 2.
Basic Control Structures
Control Structures CPS120: Introduction to Computer Science Lecture 5.
Pseudocode Algorithms Using Sequence, Selection, and Repetition Simple Program Design Third Edition A Step-by-Step Approach 6.
Advanced Program Design. Review  Step 1: Problem analysis and specification –Specification description of the problem’s inputs and output –Analysis generalize.
Quiz 3 is due Friday September 18 th Lab 6 is going to be lab practical hursSept_10/exampleLabFinal/
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
CS412/413 Introduction to Compilers Radu Rugina Lecture 18: Control Flow Graphs 29 Feb 02.
1 Control Flow Graphs. 2 Optimizations Code transformations to improve program –Mainly: improve execution time –Also: reduce program size Can be done.
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
1 Introduction to Flowcharting Computer Science Principles ASFA.
Flowcharts C++ Lab. Algorithm An informal definition of an algorithm is: a step-by-step method for solving a problem or doing a task. Input data A step-by-step.
IST 210: PHP LOGIC IST 210: Organization of Data IST210 1.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
DEFINITIONS FOR DR. HALVERSON’S CLASSES. DEFINING TERMS A correctly formed DEFINITION of a term consists of 2 parts  Noun – statement of the basic nature.
1 CSC103: Introduction to Computer and Programming Lecture No 9.
Computer Program Flow Control structures determine the order of instruction execution: 1. sequential, where instructions are executed in order 2. conditional,
Programming Techniques
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.
REPETITION CONTROL STRUCTURE
ALGORITHMS CONDITIONAL BRANCH CONTROL STRUCTURE
Lecture 7: Repeating a Known Number of Times
Think What will be the output?
Introduction to Flowcharting
Control Structures
Topics discussed in this section:
Loops in C C has three loop statements: the while, the for, and the do…while. The first two are pretest loops, and the the third is a post-test loop. We.
Chapter 6 Repetition Objectives ❏ To understand basic loop concepts:
Control Structure Senior Lecturer
Programming Problem solving Debugging
Repetition and Loops while do while for continue break
Objectives After studying this chapter, you should be able to:
Understanding the Three Basic Structures
Algorithms Take a look at the worksheet. What do we already know, and what will we have to learn in this term?
LOOPS BY: LAUREN & ROMEO.
` Structured Programming & Flowchart
Faculty of Computer Science & Information System
Computer Science Core Concepts
ICT Programming Lesson 3:
JavaScript: Control Statements II
Program Flow.
The structure of programming
The structure of programming
Building Java Programs
Introduction to Flowcharting
Thinking procedurally
Presentation transcript:

Basic Building Blocks of Programming

Variables and Assignment Think of a variable as an empty container Assignment symbol (=) means putting a value into a variable (container) –This is not the same as ‘equal’ Initialization –Before doing repetitive computations, usually needs initialization value (usually 0 or 1) Swapping –To swap values between two variables, we need a third dummy variable to temporarily store the value.

Sequential execution Branching Loops Nested structure

Sequential execution Proper sequence is important. Following instructions in different sequences will give different results (or no result)

Branching Also called –Conditional structure –Decision –IF statement

Loops Also called repetition, recursion Two types –Counted –Conditional Avoid infinite loops!

Patterns and Structure Separate data and variables –Look at empty variables Look for patterns and structure of empty variables to help in constructing algorithms –Loops (repetitions) –Conditions (branching)

Walk-through Also called tracing an algorithm To check whether the algorithm would produce the expected result