C++
Getting Started
hello.cpp
#include <iostream>
int main() {
std::cout << "Hello Vietelligent\n";
return 0;
}$ g++ hello.cpp -o hello
$ ./hello
Hello VietelligentVariables
int number = 5; // Integer
float f = 0.95; // Floating number
double PI = 3.14159; // Floating number
char yes = 'Y'; // Character
std::string s = "ME"; // String (text)
bool isRight = true; // Boolean
// Constants
const float RATE = 0.8;Primitive Data Types
Data Type
Size
Range
User Input
Swap
Comments
If statement
Loops
Functions
References
Namespaces
C++ Arrays
Declaration
Manipulation
Displaying
Multidimensional
C++ Conditionals
If Clause
Else if Statement
Operators
Ternary Operator
Switch Statement
C++ Loops
While
Do-while
Continue statements
Infinite loop
for_each (Since C++11)
Range-based (Since C++11)
Break statements
Several variations
C++ Functions
Arguments & Returns
Overloading
Built-in Functions
C++ Classes & Objects
Defining a Class
Creating an Object
Constructors
Destructors
Class Methods
Access Modifiers
Getters and Setters
Inheritance
C++ Preprocessor
Preprocessor
Includes
Defines
If
Error
Macro
Token concat
Stringification
file and line
Miscellaneous
Escape Sequences
Last updated