C++ COMMENTS

In any programming language, comments are most important to explain the program. Humans can easily understand what the program is doing by looking at the comments. Comments are ignored by the c++ compiler. We can also comment on unused code for later use.

There are two types of comments in C++.

        1. Single Line Comment (//)

        2. Multi Line Comment (/*.............*/

1. Single line Comment 

         It is used for comment out only one line at starting. 

 

 

2. Multi Line Comment

          It is used for comment out multiple lines

Single line comments are also used at starting of every line. This is the most common use of comments in c++ in the Linux operating system even multi-line comments work fine.

#include <iostream>
using namespace std;
int main()
{
    //printing Hello World!
    cout << "Hello World!"<<endl;
}

#include <iostream>
using namespace std;
int main()
{
    /*This is the 
    program to print
    Hello World*/
    cout << "Hello World!"<<endl;
}

#include <iostream>
using namespace std;
int main()
{
    //This is the 
    //program to print
    //Hello World
    cout << "Hello World!"<<endl;
}

 Contact Us:

                  codecalculatenr@gmail.com

 

About Us : 

        Code Calculate is the biggest online platform