How to add Comments in C++

How to add Comments in C++


Every comment-program is the explanation statement that we also include in the C++ code. The comment statements can help anyone to understand each processing steps by steps by reading from the source code. All programming languages always allow for some forms of comments, but in different forms of each programming language.

The C++ comments support single-line and multiple-line. All characters must be available inside any comment and always ignored by the compiler of C++.

Normally, C++ comments start with /* and end with */. For example:
/*This is my comment in single-line*/

/*This my comment in multiple-line
*C++ can also support for multiple-line
*/

We can also extending the comment at the of each line with //. For example:

#include<iostream>
using namespace std;
main(){
 cout<<"Hello World!"; //Prints Hello World!
return 0;
}
When compile the source code above, the compiler will ignore //Prints Hello World!, So the final executable result will be produced the by following:

Hello World!

Within a /* and */ comment and a // character have no special meaning. Mean that all of thus, you can 'hideaway' just one kind of comment. For example have shown above.

Learn more about C++, click here to view  the table contents

Comments

Popular posts from this blog

ភាសាកម្មវិធី C++៖ សង្ខេប

សំណួរ និងលំហាត់៖ ភាពខុស​គ្នា​រវាងភាសា C និងភាសា C++

How to download and install Cambridge Advanced Learner's Dictionary_Fourth Edition-CALD4