Académique Documents
Professionnel Documents
Culture Documents
2
Class Objectives
2
cntroduction
Elements of a Computer System
Hardware
± CPU
± Main memory
± Secondary storage
± cnput/output devices
Software
3
CPU (Central Processing Unit)
CU (control unit):
± Fetches and decodes instructions
± Controls flow of information in and out of MM
± Controls operation of internal CPU components
PC (program counter): points to next instruction to
be executed
4
CPU (Central Processing Unit)
(continued)
c (instruction register): holds instruction currently
being executed
ALU (arithmetic logic unit): carries out all arithmetic
and logical operations
`
Software
`2
`3
The Evolution of Programming
Languages
`4
Assembly Language
`5
Assembly Language (continued)
Using assembly language instructions, h
can be written as:
h
`6
High-Level Languages
`7
Your first C++ Program
w
!
:
ï
!""
#$
`8
Processing a C++ Program
`9
High-Level Languages
2
Your first C++ Program
2`
Comments
± Multiple line
)
##
# #
* #$
22
Output
The syntax of
and ++ is:
23
Output
A manipulator is used to format the output
± Example: # causes insertion point to move to
beginning of next line
Special Symbols
Special symbols
Arithmetic operators: +, - , *, /
Punctuation: ;
// , /*, << , { } , ( )
25
Preprocessor Directives
# +
, : preprocessor directive
26
Preprocessor Directives
For example:
# +
,
27
Preprocessor Directives
28
# and Using
in a
Program
##
allows you to use
and # without the prefix
--
%--
.--#&
To use
.# in a program, use the
following two statements:
# +
,
##
29
eserved Words (Keywords)
eserved words, keywords, or word symbols
± cnclude:
'#
#
#
#
(
/
#
*
#
3
A C++ Program2
A string
3`
Sections covered from the book
32