Menu

C++ TUTORIALS - C++ Basic Syntax

C++ Basic Syntax

ADVERTISEMENTS

C++ Keywords:

asmelsenewthis
autoenumoperatorthrow
boolexplicitprivatetrue
breakexportprotectedtry
caseexternpublictypedef
catchfalseregistertypeid
charfloatreinterpret_casttypename
classforreturnunion
constfriendshortunsigned
const_castgotosignedusing
continueifsizeofvirtual
defaultinlinestaticvoid
deleteintstatic_castvolatile
dolongstructwchar_t
doublemutableswitchwhile
dynamic_castnamespacetemplate 

ADVERTISEMENTS

Trigraphs:

TrigraphReplacement
??=#
??/\
??'^
??([
??)]
??!|
??<{
??>}
??-~

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      retVal

Whitespace in C++:

int age;

fruit = apples + oranges;   // Get the total fruit