回答于 2025-09-03
English Translation for Comment Statements in C++
In C++, there are two main ways to write comments (explanatory notes for humans that aren't executed by the compiler):
✅ Single-line comments
Use // → Everything after these double slashes until the end of the line is ignored by the compiler.
Example: // This is a single-line comment
✅ Multi-line comments
Enclose text between /* and */ → Can span multiple lines.
Example:
cpp
/* This is a multi-line comment
covering several lines */
Both types serve exactly the same purpose: adding readable documentation/annotations to your code without affecting its functionality. Programmers commonly use them to explain logic, mark temporary TODOs, or disable code temporarily during testing.