C++ TUTORIALS - C++ Basic Syntax
C++ Basic Syntax
ADVERTISEMENTS
C++ Keywords:
asm | else | new | this |
auto | enum | operator | throw |
bool | explicit | private | true |
break | export | protected | try |
case | extern | public | typedef |
catch | false | register | typeid |
char | float | reinterpret_cast | typename |
class | for | return | union |
const | friend | short | unsigned |
const_cast | goto | signed | using |
continue | if | sizeof | virtual |
default | inline | static | void |
delete | int | static_cast | volatile |
do | long | struct | wchar_t |
double | mutable | switch | while |
dynamic_cast | namespace | template |
ADVERTISEMENTS
Trigraphs:
Trigraph | Replacement |
---|---|
??= | # |
??/ | \ |
??' | ^ |
??( | [ |
??) | ] |
??! | | |
??< | { |
??> | } |
??- | ~ |
ADVERTISEMENTS
C++ Program Structure:
#include <iostream> using namespace std; // main() is where program execution begins. int main() { cout << "Hello World"; // prints Hello World return 0; }Semicolons & Blocks in C++:
x = y; y = y+1; add(x, y);
{ cout << "Hello World"; // prints Hello World return 0; }
x = y; y = y+1; add(x, y);
x = y; y = y+1; add(x, y);C++ Identifiers:
mohd zara abc move_name a_123 myname50 _temp j a23b9 retValWhitespace in C++:
int age;
fruit = apples + oranges; // Get the total fruit