C and C++ Programming Model PRT - 1
C and C++ Programming Model PRT - 1
PROGRAMMING MODEL
Gerald L. Almodiel
Sample Programs
History of C
Evolved from two programming
languages
BCPL and B
History of C++
C++ is an extension of C
Compiler Vendors
Standard Library generally provided by
Software Vendors
C++ System
C++ System generally consist of 3 parts:
Program Development Environment
Languages
Standard Library
C++ programs typically go through 6 phases:
1. Edit
2. Process
3. Compile
4. Link
5. Load
6. Execute
1. Edit
Compiler creates
Compiler Disk object code and stores
it on disk.
2. Process
Linker links the object
Linker Disk code with the libraries,
creates a.out and
3. Compile
Primary
stores it on disk
Memory
Loader
4. Link
Loader puts program
Disk
in memory.
..
..
5. Load
..
Primary
Memory
6. Execute
CPU
CPU takes each
instruction and
executes it, possibly
.. storing new data
..
.. values as the program
executes.
CSCI6B : Computer Organization, Architecture and Assembly Language Programming 12/7/2013
Introduction to C++ Programming
8
Input/output
cin
Standard input stream
Normally keyboard
cout
Standard output stream
Normally computer screen
cerr
Standard error stream
Display error messages
Namespace
std:: specifies using name that belongs to
“namespace” std
std:: removed through use of using statements
Endl
Indicates the end of a specific line
Comments
Document programs
Improve program readability
Ignored by compiler
Single-line and Multiline comments
Begin with //
Begin with /* and ends with */
Preprocessor directives
Processed by preprocessor before compiling
Begin with #
Scape Sequence
Escape Sequence Description
#include <iostream> //allows the program to output the data to the scree
ANY QUESTIONS ?
~ FIN