Introduction To Programming-SE1133
Introduction To Programming-SE1133
Asia Shahab
Previous Lecture Summary
• Introduction to Computers
• Components of a Computer
• Storage Devices
• Register Memory
• System Software
• Application Software
What is a Computer??
• A computer is an electronic device that manipulates information, or data. It has the ability
to store, retrieve, and process data.
• Computer is an electronic device that takes raw data as an input from the user and processes
it under the control of a set of instructions (called program), produces a result (output), and
saves it for future use.
• A computer is a machine or device that performs processes, calculations and operations based
on instructions provided by a software or hardware program. It has the ability to accept data
(input), process it, and then produce outputs.
Cont…
• Computers are electronic devices that can follow instructions to
• Accept input
• Process that input
• Produce information
• Alternatively, a computer is a device capable of performing calculations and making
logical decisions at speeds millions, and even billions, of times faster than human
beings can.
Instructions
A Computer Results
System
Data
Computer Instructions and Programs
Instruction:
A computer instruction is a command or directive/instruction given to a
computer to perform specific task.
Examples: Add 2 and 5, Print “Hello World”
Program:
A program is sequence of instructions written in programming language that
directs a computer to solve a problem
Examples: Draw a square, etc.
Cont…
Program “Draw a square”
Application Programs
(.cpp, .c, .java,)
Compilers / Libraries
(C++, C, Java)
Operating Systems
(Windows, Linux, MAC, Solaris)
Computer Hardware
9
Programming Languages
1. Machine language
2. Low-level languages
3. High-level languages
10
1. Machine level languages
14
1. Understanding the Problem
• Problems are often described in natural language like English.
• Users may not be able to specify needs well, or the needs may changing frequently
3. Indirect inputs (may not be given directly, you have to calculate or assume)
15
1. Understanding the Problem
Example: Calculate the area of a circle having the radius of 3 cm
• Inputs: Radius=3
• Output: Area
Area = pi r^2
16
2. Plan the Logic
17
3. Code the Program
Code the program:
18
4. Test the Program
Testing the program
• Execute it with sample data and check the results
• Identify logic errors if any (undesired results or output) and correct
them
• Choose test data carefully to exercise all branches of the logic
(Important)
19
5. Deploy the Program
20
Introduction to Pseudocode
• One of the popular representation based on natural language/
English like statements
• Easy to read and write
• Allow the programmer to concentrate on the logic of the
problem
• Structured in English language (Syntax/grammar)
• Each instruction is written on a separate line
• Written from top to bottom, with only one entry and one
exit
Cont…
Pseudocode:
• Calculate Area
• Display Area
Flowcharts
• “A graphic representation of a sequence of operations to
represent a computer program”
• Flowcharts show the sequence of instructions in a single
program.
Flowchart Symbols
Name Symbol Description
Calculate Area =
3.14 * r * r
Display
Area
END
Summary
• What Is Computer?
• Programming Languages
• Pseudocode
• Flowcharts