Compiler Based: Example HTML
Compiler Based: Example HTML
Line 3: We then declare a function called main with the return type of int.
main() is the entry point of our program. Whenever we run a C++ program, we
start with the main function and begin execution from the first line within this
function and keep executing each line till we reach the end. We start a block
using the curly brace({) here. This marks the beginning of main's function
definition, and the closing brace (}) at line 5, marks its end. All statements
between these braces are the function's body that defines what happens when
main is called.
Line 4:
std::cout << "Hello World\n";
This line is a C++ statement. This statement has three parts: First, std::cout,
which identifies the standard console output device. Second the insertion
operator << which indicates that what follows is inserted into std:: cout. Last,
we have a sentence within quotes that we'd like printed on the screen. This will
become more clear to as we proceed in learning C++.