评论#

介绍#

C++中的注释用于在代码中添加解释或说明。它们不会影响代码的运行方式,可用于阐明逻辑、记录功能或暂时禁用部分代码。

Comments#

A single-line comment starts with // and continues until the end of the line.

// This is a single-line comment
printf("Hello!")  // Print a greeting message

// Print a greeting and then a farewell
printf("Hello!")
printf("Goodbye!")

Multiline String Comments#

C++ uses block comments (/* … */) for multi-line explanations. These are true comments and are ignored by the compiler.

/*
This project prints a greeting message,
followed by a farewell message
*/
printf("Hello!")
printf("Goodbye!")