Single-line comments start with two forward slashes (//).
Any text between // and the end of the line is ignored by the compiler (will not be executed).
This example uses a single-line comment before a line of code:
Example
// This is a comment
cout << "Hello World!";
cout << "Hello World!";
This example uses a single-line comment at the end of a line of code:
Example
cout << "Hello World!"; // This is a comment
Practice Excercise Practice now