Sunteți pe pagina 1din 7

Introduction to Computer Programming (ICP)

Lecture-4:- (September 18, 2015)

Topics covered:

1.

1. Flow Chart

2. Pseudocode

3. Algorithm
Flow Chart:

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 programs. The flowchart is a means of visually presenting the flow of data
through an information processing systems, the operations performed within the system and the
sequence in which they are performed. 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.
1.1

Flow Chart symbols


Start or end of the program
Input or output operation

Computational steps or processing function of a program

Decision making and branching

Flow line

Lecturer: ARSHAD FARHAD, CS Department |Contact: 0345-9085099 email: arshadfarhad@ciitsahiwal.edu.pk

Introduction to Computer Programming (ICP)

1.2

Flow Chart Examples

1.2.1 Example-1: Add two integer numbers

1.2.2 Example-2: Calculate pay.

Lecturer: ARSHAD FARHAD, CS Department |Contact: 0345-9085099 email: arshadfarhad@ciitsahiwal.edu.pk

Introduction to Computer Programming (ICP)

1.2.3 More examples.

Example-3: Average of 3 numbers.

Example-4: Tea recipe

Start

Inputs:
Water in kettle

Boiling
NO

Is water boiling

Yes

Input:
Ingredients

TEA

Stop

Home Work: Draw a flow chart to represent the ATM transaction.

Lecturer: ARSHAD FARHAD, CS Department |Contact: 0345-9085099 email: arshadfarhad@ciitsahiwal.edu.pk

Introduction to Computer Programming (ICP)

1.2.4 Flow Charting tools. (Try Yourself) * Will be practiced in Lab


a) MS Visio

Figure (a). To create Flow chart using MS Visio (version 2013)


b) Visual Logic
Download Link:
http://www.visuallogic.org/download
i.

Interface

Lecturer: ARSHAD FARHAD, CS Department |Contact: 0345-9085099 email: arshadfarhad@ciitsahiwal.edu.pk

Introduction to Computer Programming (ICP)

ii.

How to create flow chart for adding 2 numbers, and print the result.

iii.

Click on arrow.
Step-Default

Step-1: Click on input

Click on Input and then right click on input symbol and then edit
Step-2: click on edit

Step-3: provide input variable name

Lecturer: ARSHAD FARHAD, CS Department |Contact: 0345-9085099 email: arshadfarhad@ciitsahiwal.edu.pk

Introduction to Computer Programming (ICP)

Provide 2nd input, then add them and print the result

How to Run:
Click on play button from the top menu
Input value of a and b (a=10, b=20)

Lecturer: ARSHAD FARHAD, CS Department |Contact: 0345-9085099 email: arshadfarhad@ciitsahiwal.edu.pk

Introduction to Computer Programming (ICP)

2. Pseudocode
Pseudo code is a kind of structured English for describing algorithms.
It allows the designer to focus on the logic of the algorithm without being distracted by
details of language syntax.
At the same time, the pseudo code needs to be complete.
It describes:
The entire logic of the algorithm so that implementation becomes a route
3. Algorithm
An algorithm is a well-defined sequence of acts or procedures to perform for the solution
of a problem in a finite number of steps.
Therefore, a flowchart is an excellent vehicle to represent an algorithm.

Lecturer: ARSHAD FARHAD, CS Department |Contact: 0345-9085099 email: arshadfarhad@ciitsahiwal.edu.pk

S-ar putea să vă placă și