C++ is an object oriented programming (OOP) language and is an extended version of C language. In this tutorial, you may learn how to use the languages in a real application.

Let us first look at a simple C++ program that prints "Hello World" to the Console.

 
#include <iostream>
int main() 
{  
  std::cout << "Hello World!"; 
}  
 
Simulation Log
Hello World

Let us see how we write this code. The preprocessor directive #include tells the compiler to include the files writen in double quotes (""). In this case, the program causes the compiler to include iostream header file that defines the standard input/output stream objects. The iostream header file helps to access the built-in input/output function of the language. All C++ programs should have a main() function where the execution starts by the compiler. The execution starts with open curly brackets({) and the compiler execute each statements where the statements are ended by semi colon (;). cout displays the message "Hello World" and the program ends by the closing of the main() function with curly brackets (}). Before any code is executed, it is compiled by the compiler and check for any errors.