C++ Comments
The double slash (//) introduces a C++ comment. A comment is a remark from the programmer to the reader that usually identifies a section of a program or explains some aspect of the code. The compiler ignores comments. After all, it knows C++ at least as well as you do, and, in any case, it’s incapable of understanding comments. As far as the compiler is concerned, Listing 2.1 looks as if it were written without comments, like this:
#include <iostream>int main(){ using namespace std; cout << "Come up and C++ me some time."; cout << endl; cout << "You won't regret it!" << endl; return 0;}
C++ comments run from the // to the end of the line. A comment can be on its own line, or it can be on the same line as code. Incidentally, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access