` Structured Programming & Flowchart

Slides:



Advertisements
Similar presentations
More on Algorithms and Problem Solving
Advertisements

UNIT 2. Introduction to Computer Programming
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Mathematics for Computing Lecture 4: Algorithms and flowcharts Dr Andrew Purkiss-Trew Cancer Research UK
 Control structures  Algorithm & flowchart  If statements  While statements.
Chapter 4 Control Structures I. Objectives ► Examine relational and logical operators ► Explore how to form and evaluate logical (Boolean) expressions.
Program Design and Development
Pseudocode and Algorithms
A High-Level Model For Software Development
PROGRAMMING, ALGORITHMS AND FLOWCHARTS
CIS Computer Programming Logic
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
CSE 102 Introduction to Computer Engineering What is an Algorithm?
Selection Control Structures. Simple Program Design, Fourth Edition Chapter 4 2 Objectives In this chapter you will be able to: Elaborate on the uses.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (4): Control Flow (Chapter 2)
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure.
Visual Basic Programming
PROBLEM SOLVING WITH LOOPS Chapter 7. Concept of Repetition Structure Logic It is a computer task, that is used for Repeating a series of instructions.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #5: Programming Structures IE 212: Computational Methods for Industrial Engineering.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 5: Introduction to C: More Control Flow.
Dale Roberts 1 Program Control - Algorithms Department of Computer and Information Science, School of Science, IUPUI CSCI N305.
Algorithm Design.
I Power Higher Computing Software Development High Level Language Constructs.
`. Lecture Overview Structure Programming Basic Control of Structure Programming Selection Logical Operations Iteration Flowchart.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
Topic: Control Statements. Recap of Sequence Control Structure Write a program that accepts the basic salary and allowance amount for an employee and.
Language Find the latest version of this document at
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
FLOWCHARTING AND ALGORITHMS
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
STEP 3- DEVELOP AN ALGORITHM At this stage we break down the problem into simple manageable steps so that they can be handled easily.
Pseudocode Skill Area Materials Prepared by Dhimas Ruswanto, BMm.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
Flow Charts And Pseudo Codes Grade 12. An algorithm is a complete step-by- step procedure for solving a problem or accomplishing a task.
7 - Programming 7J, K, L, M, N, O – Handling Data.
Program design Program Design Process has 2 phases:
ALGORITHMS AND FLOWCHARTS
Chapter 9 - Multimedia IDCS - Computer Technology.
Programming Languages
GC211Data Structure Lecture2 Sara Alhajjam.
Control Structures: Part 2
CS1371 Introduction to Computing for Engineers
The Selection 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.
Ch 7: JavaScript Control Statements I.
Programming Fundamentals
JavaScript: Control Statements.
ALGORITHMS AND FLOWCHARTS
Designing and Debugging Batch and Interactive COBOL Programs
Unit# 9: Computer Program Development
How to develop a program?
Algorithms & Pseudocode
MSIS 655 Advanced Business Applications Programming
Structured Program
ALGORITHMS AND FLOWCHARTS
3 Control Statements:.
Introduction to Algorithms and Programming
Introduction to Problem Solving and Control Statements
Faculty of Computer Science & Information System
Computer Science Core Concepts
Control Structures Part 1
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Flowcharts and Pseudo Code
The structure of programming
Developing a Program.
The structure of programming
Thinking procedurally
Presentation transcript:

` Structured Programming & Flowchart Materials Prepared by Dhimas Ruswanto, BMm `

Lecture Overview Variables Structured Programming Basic Control of Structure Programming Selection Logical Operations Iteration Flowchart

Variables A Variable is a symbol that can represent different values A variable is the name for a place in the computer’s memory where you store some data

Variables Types Integer whole numbers (e.g. 1, 678, 345) Real or Float fractional numbers (e.g. 3.24) Character letter (e.g. a, f, x, c, 4) String names (e.g. Dr. H. Kelly, Sg. 745) Boolean TRUE or FALSE (0 or 1)

Structured Programming Structured programming (also called modular programming) is a subset of procedural programming that enforces a logical structure on the program being written. The structured program makes it easier and more efficient to understand and modify.

Structured Programming (cont’d) A structured programming is written using simple control structures to organize the solution to a problem. A simple structure is usually defined to be a sequence, a selection, or a repetition.

Basic Control Structures A sequence structure contains steps that is performed one after another. A selection structure contains one set of steps that is performed if a condition is true, and another set of steps that is performed if the condition is false. A repetition/iteration structure contains a set of steps that is repeated as long as a condition is true.

Selection (IF..THEN..ELSE) In an IF statement, the instructions following the THEN part of the IF statement are executed if the condition is TRUE A more comprehensive set of conditions can be created by adding an ELSE statement E.g. If I’ve got an assignment to finish I’ll have to do it, otherwise I’ll go to see the football match with you next week. When the alarm goes off get out straight out of bed, unless it’s a weekend in which case you can stay in bed a bit longer.

Selection (CASE) CASE The CASE statement is frequently used for coding the choice between item lists, such as those found in screen menus. A conditional control structure that appears in most modern programming languages and allows a selection to be made between several (multiple) sets of program statements. E.g. ATM Machine transactions. Vendor Machine

Logical Operations Logical Operators: Logical Operations: = is equal to >= is greater than or equal to <= is less than or equal to <> is not equal to Logical Operations: AND, OR, NOT, NAND, NOR, XOR

Iteration REPEAT UNTIL which tests at the end of a block of code, so the sequence of instructions are always repeated at least once WHILE which tests at the start of a block of code so it is possible that the instructions in the loop may never be executed FOR Loop which is controlled by a count given from known conditions

Flowchart A flowchart is a graphical or symbolic representation of a process. Each step in the process is represented by a different symbol and contains a short description of the process step. The flowchart symbols are linked together with arrows showing the process flow direction Flowchart uses a diagram to describe the steps in algorithm

Flowchart Symbols Termination (Start/End) Input/ output Process/Computation Comparison Connector

Flowchart Sequential Block A Block B

Flowchart Selection (If Else) True/Yes False/No cond Block B Block A

Flowchart Selection (Case)

Flowchart Iteration (Repeat Until)

Flowchart Iteration (Do While)

Flowchart Iteration (For Loop)

Flowchart Connector Block and Off Page Connector

Flowchart Examples The diagrams shown illustrates how to compute the sum of two numbers

Flowchart Examples The process of processing is shown as arrows linking the symbols

Flowchart Examples Create a flowchart for inputting your employee’s name. If the first letter starts from A to J then display “ First Category” , if K to T then display “ Second Category” otherwise display Third Category If student's grade is greater than or equal to 60 Print "passed“ else Print "failed“ Set the counter to 0. If the counter is more than 10 then customer receives free value meal otherwise no free value meal.

Summary A variable is a symbol that represent any values Basic Control Structures: Sequence Selection IF..THEN..ELSE.. CASE Iteration/Repetition REPEAT UNTIL WHILE FOR A flowchart is a graphical or symbolic representation of a process.