01 BASICS
1
Source file only expresses a piece of the program
Object files are intermediate files that represent an
incomplete copy of the program
The compiler and linker are just regular programs. The step in
the compilation process in which the compiler reads the file is
called parsing.
COMPILATION PROCESS
2
C++ is immensely popular, particularly for applications that
require speed and/or access to some low level features
It was created in 1979 by Bjarne Stroustrup, at first as a set
of extensions to the C programming language
Everything in C++ is case sensitive: someName is not the
same as SomeName
GENERAL NOTES ON C++
3
Well use a Hello, world! program as an entry point into the
basic features of C++
A Hello World program
# include < iostream >
int main () {
std :: cout << Hello , world !\ n “;
return 0;
}
HELLO WORLD PROGRAM
4
// indicates that everything following it until the end of the
line is a comment. Another way to write a comment is to put it
between /* and */ (e.g. x = 1 + /*sneaky comment here*/ 1 ;)
#include tells the preprocessor to dump in the contents of
another file, here the iostream file, which defines the
procedures for input/output.
int main() {...} defines the code that should execute when the
program starts up.
cout << : This is the syntax for outputting some piece of text
to the screen.
return 0 indicates that the program should tell the operating
system it has completed successfully.
LINEBYLINE EXPLANATION
5
Tokens are the minimal chunk of program that have meaning
to the compiler the smallest meaningful symbols in the
language.
TOKENS
Token type Description Examples
Keywords
Words with special meaning
to the compiler
int, double, for, auto
Identifiers Names of things that are
not built into the language
cout, std, x, myFunction
Literals Basic constant values
whose value is specified
directly in the source code
“Hello, world!”, 24.3, 0, ‟c‟
Operators Mathematical or logical
operations
+, -, &&, %, <<
Punctuation/Separators Punctuation defining the
structure of a program
{ } ( ) , ;
Whitespace Spaces of various sorts;
ignored by the compiler
Spaces, tabs, newlines,
comments
6
A symbol used to represent a special character in a text
literal.
ESCAPE SEQUENCES
Escape Sequence Represented Character
\a System bell (beep sound)
\b Backspace
\f Formfeed (page break)