0% found this document useful (0 votes)
27 views29 pages

Lecture #4

meowq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views29 pages

Lecture #4

meowq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 29

CS100:

COMPUTATIONAL
PROBLEM SOLVING
(FALL 2022-23)
Lecture 4
TODAYS TOPICS:

 Broader Picture of Computing


 Number Systems, ASCII code
 Data Types
HELPFUL READINGS:

 Cay Horstmann:
Chapter 1: Section 1.2,1.3
Chapter 2: 2.1,2.3 (partial)
THE BROADER PICTURE
OF COMPUTING
THE ANATOMY OF A COMPUTER –
THE CPU
 The CPU (central processing unit)
 heart of the computer
 executes one operation at a time
 performs program control and data processing

C++ for Everyone by Cay Horstmann


Copyright © 2012 by John Wiley & Sons. All rights reserved
THE ANATOMY OF A
COMPUTER – THE CPU
 The CPU
 carries out arithmetic operations such as
addition, subtraction, multiplication, and
division
 fetches data from external memory or devices
and stores data back.
 All data must travel through the CPU whenever it
is moved from one location to another.

C++ for Everyone by Cay Horstmann


Copyright © 2012 by John Wiley & Sons. All rights reserved
THE ANATOMY OF A COMPUTER
– THE STORAGE
 The computer stores data and programs in memory

 Primary memory - memory chips


 Random access memory (RAM) (read-write memory)
 Read-only memory (ROM)
 Secondary storage devices
 disk drives
 CDs

C++ for Everyone by Cay Horstmann


Copyright © 2012 by John Wiley & Sons. All rights reserved
THE ANATOMY OF A COMPUTER –
PERIPHERAL DEVICES

 The user is the human using a program that a


programmer wrote.
 The computer transmits information (called output) to the
user through a display screen, speakers, and printers.
 The user can enter information (called input) for the
computer by using a keyboard or a pointing device such
as a mouse.
squeak?

C++ for Everyone by Cay Horstmann


Copyright © 2012 by John Wiley & Sons. All rights reserved
THE ANATOMY OF A COMPUTER
SYSTEM
Integer Control Keyboard Mouse
Unit Unit
CD
Floating Point
Unit
Cache

Processor
System Bus
HD
Mem
Bus

RAM/ROM Printer Monitor


THE ANATOMY OF A COMPUTER
SYSTEM

C++ for Everyone by Cay Horstmann


Copyright © 2012 by John Wiley & Sons. All rights reserved
EVOLUTION OF COMPUTING
CHARLES BABBAGE (1791-
1871)

Designer of the Analytical Engine -


the very first computer (1833)
JOHN VON NEUMANN

 Developed the stored program


concept
MACHINE CODE

 Computer programs are stored as machine instructions


in a code that depends on the processor type.

 A typical sequence of machine instructions is


 1. Move the contents of memory location 40000
into the CPU.
 2. If that value is > 100, continue with the instruction
that is stored in memory location 11280.

C++ for Everyone by Cay Horstmann


Copyright © 2012 by John Wiley & Sons. All rights reserved
MACHINE CODE

 Machine instructions are encoded as numbers so that


they can be stored in memory.
 On a Pentium processor, this sequence of instructions
from the previous slide is encoded as the sequence of
numbers
161 40000 45 100 127 11280

 On a processor from a different manufacturer, the


encoding would be different.

C++ for Everyone by Cay Horstmann


Copyright © 2012 by John Wiley & Sons. All rights reserved
LOW-LEVEL LANGUAGES AND THE
ASSEMBLER

 Assembly language represents the machine code


and hence is processor dependent

 The assembler: Converts the low level symbolic


code (assembly language code) to machine
language

C++ for Everyone by Cay Horstmann


Copyright © 2012 by John Wiley & Sons. All rights reserved
HIGH-LEVEL LANGUAGES AND THE
COMPILER
 High-level languages like C++ are independent of
the processor type and hardware. They will work
equally well:
 on an Intel Pentium and a processor
 in a cell phone

 The compiler
 a special computer program, that translates the higher-level
description (a program) into machine instructions for a
particular processor.

C++ for Everyone by Cay Horstmann


Copyright © 2012 by John Wiley & Sons. All rights reserved
The EVOLUTION of C++
 Ancient history (pre 1972)
 C (1972)
 ANSI Standard C (1989)
 Meanwhile, Bjarne Stroustrup of AT&T adds features of the
language Simula (an object-oriented language designed for
carrying out simulations) to C resulting in:
 C++ (1985)
 ANSI Standard C++ (1998)
 ANSI Standard C++ [revised] (2003)
 The present C++
 a general-purpose language that is in widespread use for
systems and embedded
 the most commonly used language for developing
system software such as databases and operating
systems

… the future: another Standard (2011?)


C++ for Everyone by Cay Horstmann
Copyright © 2012 by John Wiley & Sons. All rights reserved
COMPUTER SOFTWARE:

 System Software:
Controls the computer
Performs the basic operating tasks

 ApplicationSoftware:
Help user to accomplish a specific task
Application Software

System Software

Hardware
SYSTEM SOFTWARE:
Operating systems
 Works as coordinator between
hardware and user software Example:
Opening a word document, screen
display, print, and save.

 Allocates system resources (CPU,


peripherals) Examples: use of key
board, mouse, playing music,
displaying on monitor
SYSTEM SOFTWARE: CONTINUED
Utility Software
 Software that augment the system
software
Example: preparing disks to store
data
SYSTEM SOFTWARE: CONTINUED
Device Driver
 The system software that helps computer
control a peripheral device. Usually supplied
by the vendor of the computer device
Example: DD for mouse, DD for Laser printer
SYSTEM SOFTWARE: CONTINUED
Programming Languages
 Tools to create the Application
Software
APPLICATION SOFTWARE

 Business software
 Productivity software
 Entertainment software
 Educational software
ASCI/ANSII CODE
TABLE
 American Standard Code for Information Exchange (ASCI): 0-
127
 American National Standards Institute (ANSI): 0-255

Code Value Type ASCII ANSII


0-31 Control YES YES
Characters
32-126 Printable YES YES
Characters
127 Control YES YES
Characters
128-159 More Printable NO YES
Characters
160-255 More Printable NO YES
Characters

Thanks to:https://simple.wikipedia.org/wiki/ASCII
Thanks to:https://simple.wikipedia.org/wiki/ASCII
Number System

ReviseBinary, Decimal and


Hexadecimal System
 Details will be covered in a tutorial
ASCI USAGE EXAMPLE IN C++

 ‘\x’ escape sequence denotes a


hexadecimal ASCI/ANSI code

 cout << ”\x41”; // A will be printed


 cout << ”Hello\x9\x9World”; // Hello World output

You might also like