0% found this document useful (0 votes)
5 views

Lecture#2 (Introduction II)

Introduction II

Uploaded by

fadajit256
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Lecture#2 (Introduction II)

Introduction II

Uploaded by

fadajit256
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Intro to Programming

Week # 1
Hardware / Software
Lecture # 2

05/08/2022 NUTECH Islamabad 1


Computers Have Two Main Parts
1. Computer Hardware

2. Computer Software

05/08/2022 NUTECH Islamabad 2


What is Computer Hardware?
• Computer Hardware is the physical part
of the computer system, the machinery
and equipment

05/08/2022 NUTECH Islamabad 3


Computer Software's
• Computer Software are programs that tell the
computer what to do.

05/08/2022 NUTECH Islamabad 4


What is a Computer?
• Computer
– Device capable of performing computations and
making logical decisions
– Computers process data under the control of sets of
instructions called computer programs
• Hardware
– Various devices comprising a computer
– Keyboard, screen, mouse, disks, memory, CD-ROM,
and processing units
• Software
– Programs that run on a computer

05/08/2022 NUTECH Islamabad 5


How to Communicate with
computer?
• Computer understands its own machine language
(language of 0s and 1s).

• Language instructs computer to perform tasks.

• We need to understand computer’s language to


communicate with it and to make it perform our
desired functions.

• So we have….

05/08/2022 NUTECH Islamabad 6


Programming Language
– Set of rules and symbols used to construct a
computer program
– A language used to interact with the computer

05/08/2022 NUTECH Islamabad 7


Machine Languages, Assembly Languages,
and High-level Languages

Three types of programming languages


1. Machine languages
• Strings of numbers giving machine specific instructions
• Example:
+1300042774
+1400593419
+1200274027
2. Assembly languages
• English-like abbreviations representing elementary
computer operations (translated via assemblers)
• Example:
LOAD BASEPAY
ADD OVERPAY
STORE GROSSPA
05/08/2022
Y NUTECH Islamabad 8
Machine Languages, Assembly Languages,
and High-level Languages

Three types of programming languages


(continued)
3. High-level languages
• Codes similar to everyday English
• Use mathematical notations (translated via
compilers)
• Example:
grossPay = basePay + overTimePay

05/08/2022 NUTECH Islamabad 9


What is C
• C is a programming language developed at AT &
T’s Bell Laboratories of USA in 1972.
• It was designed and written by a man named
Dennis Ritchie.
• Influenced by
• ALGOL 60 (1960),
• CPL (Cambridge, 1963),
• BCPL (Martin Richard, 1967),
• B (Ken Thompson, 1970)

05/08/2022 NUTECH Islamabad 10


What is C…..
• Used to develop UNIX
• Used to write modern operating systems
• Hardware independent (portable)
• C began to replace the more familiar languages of
that time like PL/I, ALGOL, etc
• Because it is reliable, simple and easy to use.

05/08/2022 NUTECH Islamabad 11


Steps in C/C++

05/08/2022 NUTECH Islamabad 12


The C++ Character Set
A character denotes any alphabet, digit or special
symbol used to represent information.

05/08/2022
We have 32 special symbols
NUTECH Islamabad 13
Constants, Variables and
Keywords
The alphabets, numbers and special symbols when
properly combined form constants, variables and
keywords.
 A constant is an entity that doesn’t change.
Whereas a variable is an entity that may change.

05/08/2022 NUTECH Islamabad 14


Types of C Constants
C++ constants can be divided into two major categories:
– Primary Constants
– Secondary Constants
These constants are further categorized as shown in
Figure

05/08/2022 NUTECH Islamabad 15


Program Errors
• Syntax errors
– Related to the error in grammar/syntax of a
language
• Run time errors
– during execution
– indicate bugs
– example: un-handled exceptions, memory
overrun.
• Logical errors
– Bug in program that causes program to
operate incorrectly, but not terminate.
05/08/2022 NUTECH Islamabad 16
Tools of the trade

• Editor
• Interpreter and Compilers
• Debuggers

05/08/2022 NUTECH Islamabad 17


17
Integrated Development Environment
(IDE)

It contains
Editor
Compilers
Debugger
Linkers
Loaders

05/08/2022 NUTECH Islamabad 18


18
Program is created in the
Editor Disk editor and stored on disk.
Preprocessor program
Preprocessor Disk processes the code.
Compiler creates
Compiler Disk object code and stores
it on disk.
Linker Disk Linker links the object
code with the libraries
Primary Memory
Loader
Loader puts program
in memory.
Disk .
.
.
..
.

Primary Memory
CPU takes each
CPU instruction and
executes it, possibly
storing new data
..
..
values as the program
..
executes.
05/08/2022 NUTECH Islamabad 19
19

You might also like