Ministry of Higher Education Computer Department
Noble Institute 1st Stage
C++ Programming
Academic Year
2018-2019
Lecturer
Zanco A. Taha (MSc.)
Lecture Outlines
1. Introduction To Flowcharts
2. Introduction To Algorithms
2
Introduction to flowcharts
• A flowchart is a graphical representation of a program steps.
These flowcharts play a vital role in the programming and
are quite helpful in understanding the logic of complicated
and lengthy problems.
• flowchart is a must for the better documentation of a
complex program.
3
Flowchart Symbols
4
Flowchart Examples- Sum Of Two Numbers
Sum
5
Flowchart Examples- Average Of Two Numbers
6
Flowchart Examples- Finding Largest of 2 Numbers
Yes No
7
Introduction to Algorithms
• It is a well-defined procedure that allows a computer to
solve a problem.
• Systematic logical approach used to solve problems in a
computer.
Algorithm Example-1
Algorithm for finding the average of two numbers:
Input: two numbers x and y
Output: the average of x and y
Steps:
input x
input y
sum = x + y
average = sum /2
print average
Algorithm Example-2
Algorithm for finding the Largest of two numbers:
Input: two numbers x and y
Output: the Max of x and y
Steps:
input x
input y
If x > y
print x
Else
print y
Homework
Q1/Write an algorithm for finding the area of a rectangle
Hints:
• define the inputs and the outputs
• define the steps
• draw the flowchart
• Q2/Write a flowchart and an algorithm for finding the max of
3 numbers.