Lecture #2: Introduction to Flowcharting مخططات الانسياب Dr. Hmood Al-Dossari King Saud University Department of Computer Science 13 February 2012.

Slides:



Advertisements
Similar presentations
Working With Algorithm and Flowcharts
Advertisements

Code Visual to Flowchart Basem AL-yasouri Ayad R Meshalmeha Fadi Alalean Loay abu odah.
Introduction to Flowcharting
Introduction to Flowcharting
Creating Flowcharts Principles Of Engineering
UNIT 2. Introduction to Computer Programming
Introduction to Flowcharting
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
ALGORITHMS AND FLOWCHARTS
Computer Programming Rattapoom Waranusast Department of Electrical and Computer Engineering Faculty of Engineering, Naresuan University.
Fundamentals of Algorithms MCS - 2 Lecture # 4
Flow Chart.
King Saud University College of applied studies and community services CSC 206 Programming with Basic Lecture 1.
Chapter 2- Visual Basic Schneider
Developing logic (Examples on algorithm and flowchart)
Chapter 3 Planning Your Solution
The Program Design Phases
Review Algorithm Analysis Problem Solving Space Complexity
(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.
Chapter 1 Pseudocode & Flowcharts
ALGORITHMS AND FLOWCHARTS
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
Chapter 2: Beginning the Problem-Solving Process
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.
Introduction to Computers (L02) * Hardware * Software * Programming Languages * Three Phase of Program Development * Development and Design Steps * Algorithms.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
Introduction to Video Game Programming (VGP) Mr. Shultz.
Flowcharts.
Chapter 1 Pseudocode & Flowcharts
1 Program Planning and Design Important stages before actual program is written.
Flowcharting An Introduction. Definition A flowchart is a schematic representation of an algorithm or a process.
(C)opyright 2000 Scott/Jones Publishers Introduction to Flowcharting.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
1 Introduction to Flowcharting Computer Science Principles ASFA.
Flowchart. a diagram of the sequence of movements or actions of people or things involved in a complex system or activity. a graphical representation.
Lecture 3 Computer Programming -1-. The main steps of program development to solve the problem: 1- problem definition : The problem must be defined into.
Problem Solving Flowcharts. Flowcharts Introduction  Flowcharts allow us to create a visual representation of a solution to a problem DRAW  With flowcharts,
Algorithms and Flowcharts
Creating Flowcharts Principles of Engineering
Creating a Flowchart Computer Integrated Manufacturing
ALGORITHMS AND FLOWCHARTS
GC101 Introduction to computers and programs
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Introduction to Flowcharting
IGCSE 1 Cambridge Algorithms and flowcharts Unit 7 Computer Science
Introduction to Flowcharting
Flowcharting: Decision Structure
Introduction to Flowcharting
Creating Flowcharts Principles of Engineering
Creating Flowcharts AIM:
ALGORITHMS AND FLOWCHARTS
Creating Flowcharts Principles of Engineering
How to develop a program?
Introduction to pseudocode
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
ALGORITHMS AND FLOWCHARTS
Faculty of Computer Science & Information System
Introduction to Programming
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Creating Flowcharts Principles of Engineering
Introduction to Flowcharting
WJEC GCSE Computer Science
Creating Flowcharts Principles Of Engineering
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Introduction to Programming
Introduction to Flowcharts
Presentation transcript:

Lecture #2: Introduction to Flowcharting مخططات الانسياب Dr. Hmood Al-Dossari King Saud University Department of Computer Science 13 February 2012

Overview  What is a Flowchart? (المخططات الانسيابية)  Basic Flowchart Symbols (رموز واشكال المخططات الانسيابية)  Stepping Through the Flowchart (تتبع مخطط انسيابي)  Four Flowchart Structures (أنواع مخططات الانسياب)  Review (مراجعة)

What is a Flowchart?  It is a chart to describe the follow of the solution process.  رسم بياني لتمثيل سير برنامج لحل مشكلة معينة  The flowchart can be defined as a diagrammatic representation of an algorithm.  تمثيل رسومي لخوارزمية معينة START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read Pay Rate Multiply Hours by Pay Rate. Store result in Gross Pay. Display Gross Pay END ابدأ اظهر رسالة كم عدد ساعات العمل؟ اقرأ ساعات العمل اظهر رسالة كم أجر الساعة؟ اقرأ أجر الساعة احسب الأجرة : اضرب عدد ساعات العمل في أجر الساعة اظهر النتيجة على الشاشة نهاية

Basic Flowchart Symbols  Notice there are three types of symbols in this flowchart: Rounded rectangles (بيضاوي) Parallelograms (متوازي المستطيلات) A rectangle (مستطيل)  Each symbol represents a different type of operation. START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read Pay Rate Multiply Hours by Pay Rate. Store result in Gross Pay. Display Gross Pay END Rounded Rectangle Parallelogram Rectangle Rounded Rectangle

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

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

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

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

How many hours did you work? START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read Pay Rate Multiply Hours by Pay Rate. Store result in Gross Pay. Display Gross Pay END Variable Contents: Hours: ? Pay Rate: ? Gross Pay: ? Output Operation Stepping Through the Flowchart

How many hours did you work? 40 START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read Pay Rate Multiply Hours by Pay Rate. Store result in Gross Pay. Display Gross Pay END Variable Contents: Hours: 40 Pay Rate: ? Gross Pay: ? Input Operation (User types 40) Stepping Through the Flowchart

How much do you get paid per hour? START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read Pay Rate Multiply Hours by Pay Rate. Store result in Gross Pay. Display Gross Pay END Variable Contents: Hours: 40 Pay Rate: ? Gross Pay: ? Output Operation Stepping Through the Flowchart

How much do you get paid per hour? 20 START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read Pay Rate Multiply Hours by Pay Rate. Store result in Gross Pay. Display Gross Pay END Variable Contents: Hours: 40 Pay Rate: 20 Gross Pay: ? Input Operation (User types 20) Stepping Through the Flowchart

How much do you get paid per hour? START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read Pay Rate Multiply Hours by Pay Rate. Store result in Gross Pay. Display Gross Pay END Variable Contents: Hours: 40 Pay Rate: 20 Gross Pay: 800 Process: The product of 40 times 20 is stored in Gross Pay Stepping Through the Flowchart

Your gross pay is 800 START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read Pay Rate Multiply Hours by Pay Rate. Store result in Gross Pay. Display Gross Pay END Variable Contents: Hours: 40 Pay Rate: 20 Gross Pay: 800 Output Operation Stepping Through the Flowchart

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  One of two possible actions is taken, depending on a condition.

Example  أرسم مخطط انسيابي يطلب درجة الطالب ومن ثم يحدد اذا كان ناجح او راسب ادخل درجة الطالب ابدأ اطبع نتيجة الطالب نهاية

Repetition Structure  A repetition structure represents part of the program that repeats. This type of structure is commonly known as a loop.

Repetition Structure  A loop tests a condition, and if the condition exists, it performs an action. Then it tests the condition again. If the condition still exists, the action is repeated. This continues until the condition no longer exists.

Example  أرسم مخطط انسيابي يطبع الأعداد من 1 الى 10 x=x+1 ابدأ أطبع X نهاية x=0

Controlling a Repetition Structure  ماهي مخرجات مخطط الانسياب التالي؟ أطبع X نهاية ابدأ x=0

Test  ماهي مخرجات مخططات الانسياب التالية؟ x=x+2 ابدأ أطبع X نهاية x=0 x=x+2 ابدأ أطبع X نهاية x=1

Case Structure  One of several possible actions is taken, depending on the contents of a variable.

Case Structure  The structure below indicates actions to perform depending on the value in years_employed. CASE years_employed Other bonus = 100 bonus = 200 bonus = 400 bonus = 800

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

Combining Structures  Structures are commonly combined to create more complex algorithms.  The flowchart segment below combines a decision structure with a sequence structure. x < y? Display x Add 1 to x YES

 This flowchart segment shows two decision structures combined.  مثال: اطبع العدد اذا كان بين 10 و20 Combining Structures Display “x is within limits.” Display “x is outside the limits.” YESNO x > min? x < max? YES NO Display “x is outside the limits.”

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

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

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

Answer  Sequence (متسلسل)  Decision (متفرع)  Repetition (دوران)  Case (متعدد)

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

Answer  Repetition

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

Answer  Sequence

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

Answer  Case

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

Answer  Decision