Comments in C++

Notes:

Comments in C++ Programming Language:
Comments are something like notes in the code.

Comments are used to explain the code logic,
so that we can be able to understand the code later
as well as
other developers can also be able to read and understand the code easily.
Comments are used to increase the readability and understandability of the source code.

Comments are used to document the source code. (Documentation)

Note:
Comments are ignored by the C++ compiler.

Types of comments in C++:
There are 2 types of comments in C++
Single line comment (// comment goes here)
Multiline comment (/* comment goes here */)

Single line comment: anything written after // symbols in the line is treated as a comment
Multiline comment: anything written in between /* and */ is treated as a comment

Note: If we don’t want to execute some part(s) of the code, we can comment them so that they can be ignored by the compiler.

Example Code:
/*
Author : Manjunath Chidre
Program: for displaying Hello world! 3 times
*/

#include <iostream>

using namespace std;

int main()
{
// cout is a built in object, cout stands for console output
// cout is declared inside iostream header file

// cout << "Hello world!" << endl;

/*
cout << "Hello world!" << endl;
cout << "Hello world!" << endl;
*/

cout << "Hello world!" << endl;
cout << "Hello world!" << endl;
cout << "Hello world!" << endl;

return 0;
}