C Programming Technique – Firdaus-Harun.com

Slides:



Advertisements
Similar presentations
ALGORITHMS AND FLOWCHARTS
Advertisements

More on Algorithms and Problem Solving
Representing an algorithm using Flowcharts
Algorithms An algorithm is a finite sequence of instructions, logic, an explicit step-by-step procedure for solving a problem. Specific algorithms sometimes.
PROBLEM SOLVING TECHNIQUES
Flow Control Analysis & Design Tool: Flowcharts
UNIT 2. Introduction to Computer Programming
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 2 - Problem Solving
Computer Programming Rattapoom Waranusast Department of Electrical and Computer Engineering Faculty of Engineering, Naresuan University.
 Control structures  Algorithm & flowchart  If statements  While statements.
Chapter 2- Visual Basic Schneider
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 3 - Structured Program Development Outline.
Algorithms. Introduction Before writing a program: –Have a thorough understanding of the problem –Carefully plan an approach for solving it While writing.
Developing logic (Examples on algorithm and flowchart)
Structured Program Development in C
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 3 Planning Your Solution
The Program Design Phases
Review Algorithm Analysis Problem Solving Space Complexity
PRE-PROGRAMMING PHASE
Fundamentals of C programming
ALGORITHMS AND FLOWCHARTS
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
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Structural Program Development: If, If-Else Outline.
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.
Structured Program Development Outline 2.1Introduction 2.2Algorithms 2.3Pseudo code 2.4Control Structures 2.5The If Selection Structure 2.6The If/Else.
Lecture 2: Logical Problems with Choices. Problem Solving Before writing a program Have a thorough understanding of the problem Carefully plan an approach.
PSEUDOCODE C Programming Technique – Firdaus-Harun.com.
C Lecture Notes 1 Structured Program Development.
ALGORITHMS AND FLOWCHARTS CSCI 105 – Computer Fluency.
Dale Roberts 1 Program Control - Algorithms Department of Computer and Information Science, School of Science, IUPUI CSCI N305.
Structured Program Development Angela Chih-Wei Tang ( 唐 之 瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan 2010.
1 Program Planning and Design Important stages before actual program is written.
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.
Chapter 2 - VB 2005 by Schneider- modified by S. Jane '081 Chapter 2 - Problem Solving 2.1 Program Development Cycle 2.2 Programming Tools.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
ALGORITHMS AND FLOWCHARTS. A typical programming task can be divided into two phases: Problem solving phase  produce an ordered sequence of steps that.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
An Introduction to Programming with C++1 Beginning the Problem- Solving Process Tutorial 2.
| MSC 8102:PROGRAMMING CONCEPTS By Vincent Omwenga, PhD. 1.
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.
 Problem Analysis  Coding  Debugging  Testing.
Algorithms and Flowcharts
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.
Program design Program Design Process has 2 phases:
ALGORITHMS AND FLOWCHARTS
Algorithm: procedure in terms of
GC101 Introduction to computers and programs
Computer Programming.
ALGORITHMS AND FLOWCHARTS
CS111 Computer Programming
Computer Programming Flowchart.
Algorithms An algorithm is a sequence of steps written in the form of English phrases that specific the tasks that are performed while solving the problem.It.
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.
Programming Logic n Techniques
ALGORITHMS AND FLOWCHARTS
Unit# 9: Computer Program Development
Algorithms & Pseudocode
Structured Program
ALGORITHMS AND FLOWCHARTS
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Faculty of Computer Science & Information System
Flowcharts and Pseudo Code
Introduction to Programming
Structural Program Development: If, If-Else
Presentation transcript:

C Programming Technique – Firdaus-Harun.com Pseudocode

Agenda Intro to Pseudocode Pseudocode vs Flowchart Technique – Write pseudocode Examples

What’s Pseudocode ? Artificial and Informal language Helps programmers to plan an algorithm Similar to everyday English Not an actual programming language

E.g : Pseudocode Read A, B Calculate C = A*B Display C Stop

Technique Do not write Start in every pseudocode Parallelogram – Read / Get OR Display / Print Rectangle – Specify the actions E.g: Calculate A = B + C OR A equals to B plus C Average = total / count Final price equals price of item plus sales tax Diamond – [Next »]

Technique (..Cont.) Diamond Selection – IF , IF / ELSE and IF / ELSE IF IF A is less than B BIG = B SMALL = A ELSE BIG = A SMALL = B Repetition – WHILE / DO/WHILE / FOR [Next example]

Comparative Between Flowchart vs Pseudocode A graphical way of writing pseudocode Rounded rectangle – terminal Parallelogram – input / output Rectangle – actions Diamonds – decision / conditional Circles – connector

E.g : Flowchart Process Output Start Terminal. Program start here Input. Enter values for A and B Process Output Stop Terminal Program end here

Comparative Between Flowchart vs Pseudocode (..Cont.) No syntax rule – Independent from any programming language Write in an ordinary language Uses a structure resembling computer structure No connector between pages

E.g : Pseudocode Read A, B Calculate C = A*B Display C Stop

E.g : Pseudocode Read A, B – Input Calculate C = A*B - Action Display C - Output Stop - Terminal

Example 2 (Selection) Read A, B BIG = B SMALL = A ELSE BIG = A IF A is less than B BIG = B SMALL = A ELSE BIG = A SMALL = B Write / Display BIG, SMALL Stop

Example 2 (Selection) Read A, B - Input BIG = B - Action IF A is less than B - Selection BIG = B - Action SMALL = A - Action ELSE - Selection BIG = A - Action SMALL = B - Action Write / Display BIG, SMALL - Output Stop - Terminal

Example 3 (Repetition) Set count to zero Set total to zero Read number WHILE ( not end-of-data ) increment count by 1 total = total + number read number IF ( count > 0 ) then average = total / count Display average Stop

Advantages Converting a pseudocode to a programming language is much more easier than converting a flowchart. As compared to flowchart, it is easier to modify a pseudocode of a program logic when program modifications are necessary.

Limitations In the cases of pseudocode, a graphic representation of program logic is not available. There are no standard rules to follow for using a pseudocode. Different programmers use their own style of writing pseudocode; and hence, Communication problem occurs due to lack of standardization.

Class Tutorial *Using previous Flowchart tutorial. Write a pseudocode to calculate Area and Perimeter of a trapezoid. Write an algorithm to set a Median for given number : ………………………..