Introduction to Flowcharting

Slides:



Advertisements
Similar presentations
Code Visual to Flowchart Basem AL-yasouri Ayad R Meshalmeha Fadi Alalean Loay abu odah.
Advertisements

Introduction to Flowcharting
Introduction to Flowcharting
Flow Control Analysis & Design Tool: Flowcharts
Introduction to Flowcharting
Use Flowchart Symbols for Structured Programming
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Computer Programming Rattapoom Waranusast Department of Electrical and Computer Engineering Faculty of Engineering, Naresuan University.
Fundamentals of Algorithms MCS - 2 Lecture # 4
Chapter 2- Visual Basic Schneider
Chapter 2: Input, Processing, and Output
Basic Building Blocks of Programming. Variables and Assignment Think of a variable as an empty container Assignment symbol (=) means putting a value into.
(C)opyright 2003 Scott/Jones Publishers Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Scott/Jones Publishers.
Algorithm & Flowchart.
CSC103: Introduction to Computer and Programming
Lecturer: Omid Jafarinezhad Sharif University of Technology Department of Computer Engineering 1 Fundamental of Programming (C) Lecture 5 Structured Program.
PROGRAMMING, ALGORITHMS AND FLOWCHARTS
Flow Charting. Goals Create Algorithms using Flow Charting procedures. Distinguish between Flow Charting and Pseudocode. Top-Down Design Bottom-up Design.
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
(C)opyright 2000 Scott/Jones Publishers Introduction to Flowcharting.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
1 Introduction to Flowcharting Computer Science Principles ASFA.
FLOWCHARTING AND ALGORITHMS
CSE 110: Programming Language I Matin Saad Abdullah UB 404.
Lecture #2: Introduction to Flowcharting مخططات الانسياب Dr. Hmood Al-Dossari King Saud University Department of Computer Science 13 February 2012.
Pseudocode (pronounced SOO-doh-kohd)  is a detailed yet readable description of what a computer program or algorithm must do, expressed in a formally-styled.
Creating Flowcharts Principles of Engineering
Creating a Flowchart Computer Integrated Manufacturing
ALGORITHMS AND FLOWCHARTS
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Introduction to Flowcharting
Flowchart Symbols Terminal Process Input/ Output Decision
REPETITION CONTROL STRUCTURE
Chapter 2: Input, Processing, and Output
Introduction to Computing
Programming Flowcharts
Computer Programming Flowchart.
The Selection Structure
Introduction to Flowcharting
Flowcharting: Decision Structure
Introduction To Flowcharting
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Numbering System TODAY AND TOMORROW 11th Edition
Creating Flowcharts Principles of Engineering
Creating Flowcharts AIM:
Microsoft Visual Basic 2005 BASICS
Pseudocode An Introduction
Creating Flowcharts Principles of Engineering
How to develop a program?
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Structured Program Design
MSIS 655 Advanced Business Applications Programming
Understanding the Three Basic Structures
Introduction to Algorithms and Programming
` Structured Programming & Flowchart
Faculty of Computer Science & Information System
Chapter 2- Visual Basic Schneider
ME 142 Engineering Computation I
Introduction to Algorithms - 1
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Creating Flowcharts Principles of Engineering
Chapter 2: Input, Processing, and Output
Introduction to Flowcharting
Creating Flowcharts Principles Of Engineering
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Introduction to Programming
Introduction to Flowcharts
Presentation transcript:

Introduction to Flowcharting Computer Science Principles 2013-2014 ASFA

What is a Flowchart? START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read PayRate Multiply Hours by PayRate. Store result in GrossPay. Display GrossPay END A flowchart is a diagram that depicts the “flow” of a program. The figure shown here is a flowchart for the pay-calculating program shown in Program 1-1.

Basic Flowchart Symbols Terminal START Display message “How many hours did you work?” Terminals represented by rounded rectangles indicate a starting or ending point Read Hours Display message “How much do you get paid per hour?” Read PayRate Multiply Hours by PayRate. Store result in GrossPay. START Display GrossPay END Terminal END

Basic Flowchart Symbols START Display message “How many hours did you work?” Input/Output Operations represented by parallelograms indicate an input or output operation Read Hours Display message “How much do you get paid per hour?” Input/Output Operation Read PayRate Multiply Hours by PayRate. Store result in GrossPay. Display message “How many hours did you work?” Read Hours Display GrossPay END

Basic Flowchart Symbols START Display message “How many hours did you work?” Processes represented by rectangles indicates a process such as a mathematical computation or variable assignment Read Hours Display message “How much do you get paid per hour?” Read PayRate Multiply Hours by PayRate. Store result in GrossPay. Process Multiply Hours by PayRate. Store result in GrossPay. Display GrossPay END

Four Flowchart Structures Sequence Decision Repetition Case

Sequence Structure A series of actions are performed in sequence The pay-calculating example was a sequence flowchart.

Decision Structure The flowchart segment below shows how a decision structure is expressed in C++ as an if/else statement. Flowchart C++ Code YES NO x < y? Calculate a as x times 2. Calculate a as x plus y. if (x < y) a = x * 2; else a = x + y;

Decision Structure The flowchart segment below shows a decision structure with only one action to perform. It is expressed as an if statement in C++ code. Flowchart C++ Code YES NO x < y? Calculate a as x times 2. if (x < y) a = x * 2;

Repetition Structure The flowchart segment below shows a repetition structure expressed in C++ as a while loop. Flowchart C++ Code x < y? Add 1 to x YES while (x < y) x++;

Controlling a Repetition Structure The action performed by a repetition structure must eventually cause the loop to terminate. Otherwise, an infinite loop is created. In this flowchart segment, x is never changed. Once the loop starts, it will never end. QUESTION: How can this flowchart be modified so it is no longer an infinite loop? x < y? Display x YES

Controlling a Repetition Structure ANSWER: By adding an action within the repetition that changes the value of x. x < y? Display x Add 1 to x YES

Case Structure 1 2 3 Other If years_employed = 2, bonus is set to 200 CASE years_employed 1 2 3 Other bonus = 100 bonus = 200 bonus = 400 bonus = 800 If years_employed = 1, bonus is set to 100 If years_employed is any other value, bonus is set to 800

Connectors The “A” connector indicates that the second flowchart segment begins where the first segment ends. A START END

Call calc_pay function. Modules START END Read Input. Call calc_pay function. Display results. The position of the module symbol indicates the point the module is executed. A separate flowchart can be constructed for the module.

Combining Structures This flowchart segment shows two decision structures combined. Display “x is within limits.” Display “x is outside the limits.” YES NO x > min? x < max?

Review What do each of the following symbols represent? (Answer on next slide)

Answer What do each of the following symbols represent? Decision Terminal Input/Output Operation Connector Process Module

Review Name the four flowchart structures. (Answer on next slide)

Answer Sequence Decision Repetition Case

Review What type of structure is this? (Answer on next slide)

Answer Repetition

Review What type of structure is this? (Answer on next slide)

Answer Sequence

Review What type of structure is this? (Answer on next slide)

Answer Case

Review What type of structure is this? (Answer on next slide)

Answer Decision

Examples ???