This is a draft cheat sheet. It is a work in progress and is not finished yet.
Integrated Development Environment (IDE)
The Editor |
Provides an interactive environement in which to create and edit C++ |
The Compiler |
Converts source code into object code |
The Linker |
Does 3 things |
|
1. Combines various modules generated by the compiler from source code files |
|
2. Adds required code modules from program libraries that are provided by C++ |
|
3. Welds everything into a .exe file |
The Libraries |
A collection of prewritten routines that can be incorporated into programs to carry out common operations |
Program Structure
// |
Two slashes indicate a single line comment |
/* multi line comments */ |
Use / / to do several lines of comments in program |
#include |
Is called a directive |
<iostream> |
<iostream> is a header file |
int |
is a function type |
main |
the name of the function |
( ) |
could include parameters |
{ |
the beginning of main's function definition |
std::cout |
standard character output device (usually the screen) |
<< |
insertion operator - indicates what follows is inserted into the std::cout |
"Hello World!" |
the content inserted into std::cout |
; |
The end of the statement |
|
std::cout << "Hello World"; is a statement |
} |
the end of main's function definition |
// Name of program
// Program name
// What program does
#include <iostream>
int main()
{
std::cout << "Hello World!";
}
#include and Header Files
#include |
is a preprocessor directive, it directs the compiler to do something |
<iostream> |
Contains the definitions so you can use the input and output statements |
"iostream" |
Using quotes tells the compiler to search in the directory where the source file is located first |
Using Declaration and Namespaces
Standard library |
An extensive set of routines that have been written to carry many common tasks |
Namespace |
Is a fail safe so you don't name your functions the same as preprogrammed routines |
|