C++ tutorial--c++ comments


Comments


Like other languages, in C++ programing language, comments are used to explain the code written or to exclude the part of code from being executed. There are two types of comments:

-// is used to make comments for a single line. You can write only a single line of text or code after the single-line comment. For a normal text, it will be used to explain or describe the code. If you place the C++ code after the coment, this code won't be compiled.

-/* */is used to make comments for multiple lines. You can write multiple lines of text or code in the multiple-line comment block. If you place the code between /* and */, the code won't be compiled.

Example:

/* Your first program will print the words
Hello World on the screen. */
int main() //C++ program start here
{
    cout<<"Hello World\n"; // Print Hello World on the screen
    return 0; // Return 0 to the OS
}



Comments

Troy comment

 Troy

for more C++, C exercises,
please visit http://ccphplusplus.blogspot.com/


2015-05-26



This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.