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.

Slides:



Advertisements
Similar presentations
C Programming Technique – Firdaus-Harun.com
Advertisements

Introduction to Flowcharting
Introduction to Flowcharting
Prof. B. I. Khodanpur HOD – Dept. of CSE R. V. College of Engineering
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.
Documentation Letts Study Guide Information Systems - IT Chapter 19.
Reference :Understanding Computers
ALGORITHMS AND FLOWCHARTS
Computer Programming Rattapoom Waranusast Department of Electrical and Computer Engineering Faculty of Engineering, Naresuan University.
Flowcharts.
ITEC113 Algorithms and Programming Techniques
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.
PRE-PROGRAMMING PHASE
Algorithm & Flowchart.
ALGORITHMS AND FLOWCHARTS
CSC103: Introduction to Computer and Programming
Introduction to Programming Lecture Number:. What is Programming Programming is to instruct the computer on what it has to do in a language that the computer.
PROGRAMMING, ALGORITHMS AND FLOWCHARTS
An ordered sequence of unambiguous and well-defined instructions that performs some task and halts in finite time Let's examine the four parts of this.
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
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.
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)
PSEUDOCODE C Programming Technique – Firdaus-Harun.com.
ALGORITHM List of instructions for carrying out some process step by step. A sequence of instructions which has a clear meaning and can performed with.
ALGORITHMS AND FLOWCHARTS CSCI 105 – Computer Fluency.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
(C)opyright 2000 Scott/Jones Publishers Introduction to Flowcharting.
Algorithms and Pseudocode
ALGORITHMS AND FLOWCHARTS. A typical programming task can be divided into two phases: Problem solving phase  produce an ordered sequence of steps that.
Flow Charts And Pseudo Codes Grade 12. An algorithm is a complete step-by- step procedure for solving a problem or accomplishing a task.
Lecture 3 Computer Programming -1-. The main steps of program development to solve the problem: 1- problem definition : The problem must be defined into.
Program Design & Development EE 201 C7-1 Spring
Algorithms and Flowcharts
ALGORITHMS AND FLOWCHARTS
CS1010 Programming Methodology
GC101 Introduction to computers and programs
Introduction to Flowcharting
2008/09/22: Lecture 6 CMSC 104, Section 0101 John Y. Park
Flowcharting Guidelines
COVERED BASICS ABOUT ALGORITHMS AND FLOWCHARTS
Algorithms and Flowcharts
Introduction to Flowcharting
Lecture 2 Introduction to Programming
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
Introduction to Flowcharting
Introduction to Computer Programming
ALGORITHMS AND FLOWCHARTS
Unit# 9: Computer Program Development
ALGORITHMS AND FLOWCHARTS
How to develop a program?
ALGORITHMS AND FLOWCHARTS
Introduction to Algorithms and Programming
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Chapter 2- Visual Basic Schneider
ME 142 Engineering Computation I
Algorithm and Ambiguity
Click to add Text Computers & Instructions. Computers are given instructions in the form of computer programs that are created through the development.
Introduction to Programming
Chapter 2: Input, Processing, and Output
Basic Concepts of Algorithm
Introduction to Flowcharting
WJEC GCSE Computer Science
Introduction to Programming
Presentation transcript:

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 natural language rather than in a programming language. Pseudocode is sometimes used as a detailed step in the process of developing a program. It allows designers or lead programmers to express the design in great detail and provides programmers a detailed template for the next step of writing code in a specific programming language.template

Sample 1  Election Control Structures If age > 17 Display a message indicating you can vote. Else Display a message indicating you can't vote. End

Sample 2  Iteration (Repetition) Control Structures count assigned zero While count < 5 Display "I love computers!" Increment count End while

Sample 3  Pseudo-code the task of computing the final price of an item after figuring in sales tax.  Note the three types of instructions: input (get), process/calculate (=) and output (display)  Note that the operations are numbered and each operation is unambiguous and effectively computable. We also extract and list all variables used in our pseudo-code. This will be useful when translating pseudo-code into a programming language

Computing Sales Tax 1. get price of item 2. get sales tax rate 3. sales tax = price of time times sales tax rate 4 final prince = price of item plus sales tax 5. display final price 6. end Variables: price of item, sales tax rate, sales tax, final price

Sample 4  Computing Weekly Wages  Gross pay depends on the pay rate and the number of hours worked per week. However, if you work more than 40 hours, you get paid time-and-a-half for all hours worked over 40. Pseudo-code the task of computing gross pay given pay rate and hours worked.

Code 1. get hours worked 2. get pay rate 3. if hours worked ≤ 40 then 3.1 gross pay = pay rate times hours worked 4. else 4.1 gross pay = pay rate times 40 plus 1.5 times pay rate times (hours worked minus 40) 5. display gross pay 6. halt variables: hours worked, ray rate, gross pay This example introduces the conditional control structure. On the basis of the true/false question asked in line 3, we execute line 3.1 if the answer is True; otherwise if the answer is False we execute the lines subordinate to line 4 (i.e. line 4.1). In both cases we resume the pseudo-code at line 5.

Flowchart  A flowchart is a diagrammatic representation that illustrates the sequence of operations to be performed to get the solution of a problem. Flowcharts are generally drawn in the early stages of formulating computer solutions. Flowcharts facilitate communication between programmers and business people. These flowcharts play a vital role in the programming of a problem and are quite helpful in understanding the logic of complicated and lengthy problems. Once the flowchart is drawn, it becomes easy to write the program in any high level language. Often we see how flowcharts are helpful in explaining the program to others. Hence, it is correct to say that a flowchart is a must for the better documentation of a complex program.

Basic Symbols Rounded box - use it to represent an event which occurs automatically. Such an event will trigger a subsequent action, for example `receive telephone call’, or describe a new state of affairs. Rectangle or box - use it to represent an event which is controlled within the process. Typically this will be a step or action which is taken. In most flowcharts this will be the most frequently used symbol. Diamond - use it to represent a decision point in the process. Typically, the statement in the symbol will require a `yes' or `no' response and branch to different parts of the flowchart accordingly. Circle - use it to represent a point at which the flowchart connects with another process. The name or reference for the other process should appear within the symbol.

GUIDELINES FOR DRAWING A FLOWCHART  Flowcharts are usually drawn using some standard symbols; however, some special symbols can also be developed when required. Start or end of the program Computational steps or processing function of a program Input or output operation Decision making and branching Connector or joining of two parts of program Magnetic Tape Off-page connector Flow line Annotation Display

Draw a flowchart to find the largest of three numbers A,B, and C.

Draw a flowchart to find the sum of first 50 natural numbers.