Professional Documents
Culture Documents
1.1 Introduction
1.2 Computers: Hardware and Software
1.3 Computer Organization
1.4 Machine Languages, Assembly Languages
and High-Level Languages
1.5 Typical C++ Development Environment
1.6 C++ Keywords
1.1 Introduction
• Computer
– Device capable of performing computations and making logical
decisions
• Computer programs
– Sets of instructions that control computer’s processing of data
• Hardware
– Various devices comprising computer
• Keyboard, screen, mouse, disk, memory, CD-ROM, …
• Software
– Instructions to command computer to perform actions and make
decisions
6. Execute Primary
Memory
CPU
CPU takes each
instruction and executes
it, possibly storing
..
..
new data values as the
.. program executes
• Edit
– This phase is accomplished with an editor program
– Using a text editor, programmers create a C++ program, make
the necessary changes, and save it on disk
– A C++ program file name ends with .cpp, .cxx, or .C extension
• Preprocess
– Before the Compiler’s translation phase begins, a Preprocessor
program is executed automatically
– Preprocessor directives indicate certain manipulations to be
performed on the source program before compilation, such as
file inclusion, text replacement
• Compile
– The compiler is a program that translates a High-Level Language
(Source Code) into a machine language (Object Code)
– Following to preprocessing phase, the compiler program checks
for syntax error
• Errors in syntax or punctuation
– It points to the error to be corrected
– Once corrected, the source program should be compiled again
• Link
– When all errors are corrected, linkage editor program performs
the final step for a program to become executable
• Load
– Before a program is executed, it must be first placed in memory
– This is done by the loader, which takes the executable image
from disk and transfers it to the memory
• Execute
– Finally the computer, under the control of the CPU, executes the
program one instruction at a time
• Notes
– Each of the preceding phases can fail because of various errors
– Translating a program into executable code does not mean that it
will run correctly. We have:
• Logic error
• Run-time error, like dividing by 0
2003 Prentice Hall, Inc. All rights reserved.
14