Chapter 1 Introduction to Computers and Programming
Chapter 1 Introduction to Computers and Programming
Programming
Lecture 01 –
BS Computer Sciences
COMSATS University Islamabad (CUI), (Sep 2014 – July 2018)
Chapter 1:
Introduction
to
Computers
and
Programming
1.1
Why Program?
Why Program?
Computer – programmable machine designed
to follow instructions
Program – instructions in computer memory to
make it do something
Programmer – person who writes instructions
(programs) to make computer perform a task
8
Central Processing Unit (CPU)
The main components of the CPU are:
1. Control unit (CU)
2. Arithmetic and logic unit (ALU).
3. Registers.
9
Central Processing Unit (CPU)
1. CU (Control Unit):
Fetches and decodes instructions
10
Central Processing Unit (CPU)
3. Registers.
11
Main Memory
Directly connected to the CPU
1011010000000101
C++
BASIC Ruby
FORTRAN
Java
Visual Basic
COBOL
C#
JavaScript
C Python
1.1
Processing a Program
Processing a Program
The following steps are necessary
to process a program in C++:
Sample Run:
My first C++ program.
The sum of 2 and 3 = 5
7 + 8 = 15
54
A C++ Program
cout << "My first C++ program." << endl;
Sample Run:
My first C++ program.
Sample Run:
The sum of 2 and 3 = 5