Programming
Fundamentals
Lecture # 1
Introduction
Lecturer
Sarah Naveed
Lab Engineer
Introduce Yourself !
Name?
FSC-PreEng/ FSC-PreMed /ICS?
College?
Why BS-AI?
Title of Course : Programming Fundamentals
Course Code :
Credit Hours : 3+1
Language Used : C++
5
Assignments 10 Points
Quizzes (Un announced) 10 Points
Mid-Term exam 30 Points
Final-Term exam 50 Points
6
RECOMMENDED TEXT BOOK
how to program in c++ by dietel and dietel( latest
Edition)
REFERENCE MATERIAL
Starting out with C++, by Tony Gaddis, 7nd
Robert Lafore, “Object-Oriented Programming in C++”,
3rd/4th Edition
7
Data Types
Conditional Statements
Repetition Structures
Functions
Arrays
String Manipulation
Structures
Pointers
File Handling
8
Von-Neumann computer architecture design was proposed
in 1945.It was later known as Von-Neumann architecture.
Historically there have been 2 types of Computers:
Fixed Program Computers – Their function is very specific
and they couldn’t be reprogrammed, e.g. Calculators.
Stored Program Computers – These can be programmed to
carry out many different tasks, applications are stored on
them, hence the name.
Modern computers are based on a stored-program concept
introduced by John Von Neumann. In this stored-program
concept, programs and data are stored in the same
memory. This novel idea meant that a computer built with
this architecture would be much easier to reprogram.
9
10
It is also known as ISA (Instruction set architecture)
computer and is having three basic units:
The Central Processing Unit (CPU)
The Main Memory Unit
The Input/Output Device
1. Central Processing Unit: The central processing unit is
defined as: it is an electric circuit used for the executing
the instruction of computer program.
It has following major components:
1.1 Control Unit(CU)
1.2 Arithmetic and Logic Unit(ALU)
11
Control Unit –
A control unit (CU) handles all processor control signals.
It directs all input and output flow, fetches code for
instructions, and controls how data moves around the
system.
Arithmetic and Logic Unit (ALU) –
The arithmetic logic unit is that part of the CPU that
handles all the calculations the CPU may need, e.g.
Addition, Subtraction, Comparisons. It performs Logical
Operations, Bit Shifting Operations, and Arithmetic
operations.
Assignment question
Give a detailed overview of Von-Newman Architeture
12
“Electronic device for storing and processing
data, making calculations, or controlling
machinery.” (The Pocket Oxford Dictionary)
“An electronic device that processes data,
converting it into information that is useful
to people.” (Peter Norton)
“A programmable, multiuse machine that
accepts data – raw facts and figures – and
processes, or manipulates, it into
information we can use.” (Williams and Sawyer)
13
What makes computer different from other machines is
that:
By changing the
program Computer
(instructions), runs program!
the same
computer can be
used to perform
different function
14
The purpose of computer is
to
process data into
information
Data Information
The raw facts and Data that has been
summarized or
figures that are otherwise manipulated
processed into for use in decision
information making
15
Computers consist of
hardware and software
Hardware Software
All the machinery • All the instructions that
and equipment in a tell the computer how
computer system to perform a task
Hard devices in the • Tell the computer what
computer
to do
Anything that can
be touched • Also called a program
• Thousands of
programs exist 16
All computers follow same basic operations.
Input
Processing
Output
Storage
Communication (optional)
17
1. Input
Input - whatever is put into
(“input”) a computer system.
Input hardware - devices that
allow people to put data into Keyboard
the computer in a form that
the computer can use.
Mouse - an input device that
is used to manipulate objects
viewed on the computer
display screen.
Keyboard - an input device
that converts letters, Mouse
numbers, and other
characters into electrical
signals readable by the 18
processor.
2. Processing
Processing - the
manipulation a
computer does to
transform data into
information.
Case or system cabinet
- the box that houses
the processor chip
(CPU), the memory
chips, and the
motherboard with
power supply, as well as Case or system cabinet
some secondary
storage devices. 19
2. Processing
Processor chip - A tiny
piece of silicon that
contains millions of
electronic circuits.
Is like the brain of the
computer
Carries out instructions
from the program
Manipulate the data
Most computers have
several processors
Central Processing Unit
(CPU)
Processor chips
20
2. Processing
Memory chips
Also known as RAM
(Random Access
Memory).
Represent primary
storage or temporary
storage.
Hold data before
processing and
information after
processing.
Also stores program
instructions
Volatile
Memory chips 21
More RAM results in a
faster system
2. Processing
Motherboard - the
main circuit board in
the computer.
Everything else
attaches to the
motherboard
through connections
called ports.
Expansion slots -
“plugs” on the
motherboard for
expanding the PC’s
capabilities via
additional circuit
boards. Motherboard
22
3. Storage
Primary storage •Secondary storage (storage) -
(memory) - RAM
vs.
•The area in the computer
Computer circuitry where data or information is
that temporarily held permanently
holds data waiting
to be processed
Storage capacity is represented in:
1 byte - 1 character of data.
1 kilobyte - 1,024 characters.
1 megabyte - 1,048,576 characters.
1 gigabyte - more than 1 billion characters.
1 terabyte - more than 1 trillion characters.
23
3. Storage
Hard-disk drive - a
storage device that
stores billions of
characters of data on a
non-removable disk
platter.
Magnetic storage
(Floppy and hard drive)
uses a magnet to Hard-disk drive
access data.
24
3. Storage
CD (Compact
Disk) drive or
DVD (Digital
Video Disk) drive
- a storage device
that uses laser
technology to
read data from
optical disks.
Optical storage CD drive
25
3. Storage
Flash Memory
and USB Drive
Stores data by
turning million of
tiny switches on
and off.
Flash Memory
and USB Drive
26
4. Output
Output hardware -
devices which translate
information processed by
the computer into a form
that humans can
understand.
Peripheral device - any
component or piece of
equipment that expands
a computer’s input,
storage, and output
capabilities.
Sound card - enhances
the computer’s sound- Sound card
generating capabilities
by allowing sound to be 27
output through speakers.
4. Output
Speakers - the
devices that play
sounds
transmitted as
electrical signals
from the sound
card.
Speakers
28
4. Output
Video card -
converts the
processor’s
output
information into a
video signal that
can be sent
through a cable
to the monitor.
29
4. Output
Monitor - the display
device that takes the
electrical signals from
the video card and
forms an image using
points of colored light
on the screen.
Monitor
30
4. Output
Printer - an
output device
that produces
text and graphics
on paper.
Printer
31
5.
Communicati
ons
Modem - a device
that sends and
receives data
over telephone
lines to and from
computers.
32
33
We still need the
Software
!
34
The majority of people who purchase computers, do
so, because of software.
They want to email, or type letters.
Nearly every reason given to purchase a computer
is based on software needs.
Software tells the computer what to do
Two types
System software
Application software
35
System software
Helps the computer
perform essential
operating tasks and
enables the application
software to run
The Resource Manager
and…
36
Application
software
Enables you to perform
specific tasks. e.g:
Word Processing
Photo Editing
Creating web pages
Computer Games…
37
38
A programming language is a vocabulary and set of
grammatical rules for instructing a to perform specific
tasks.
The term programming language usually refers to
high-level languages, such as BASIC, C, C++, C#, Java,
FORTRAN, Ada, and Pascal.
In this course we will study C++ programming language.
39