2003 Prentice Hall, Inc. All Rights Reserved
2003 Prentice Hall, Inc. All Rights Reserved
2003 Prentice Hall, Inc. All Rights Reserved
Compiler
foo.o Compiler creates object code and
stores it on disk (.o file)
C++ Library Linker foo Linker links the object code with the
(a.out) libraries, stores in a.out on disk.
Loader
Loader puts program
Run in memory (RAM)
..
(load and execute) ..
..
./foo, ./a.out
• Structured programming
– Chapters 1-5
• Object-oriented programming
– Chapters 6-10
• C++ language examples
– Next few slides contain several examples
– Illustrate many important features of C++
– Each analyzed one statement at a time
Welcome to C++!
Welcome
to
C++!
Arithmetic
* Multiplication
/ Division
Integer division truncates remainder
7 / 5 evaluates to 1
% Modulus operator returns remainder
7 % 5 evaluates to 2
Arithmetic
Relational operators
> > x > y x is greater than y
< < x < y x is less than y
Equality operators
= == x == y x is equal to y
!= x != y x is not equal to y
• C Code is portable
• Portability means that is easy to adapt
software written for one type of computer
or operating system to another.
• For example, if you can easy convert a
program written for DOS so that it runs
under window . The program is portable.
•Let’s
practice
2003 Prentice Hall, Inc. All rights reserved.