示例: const int Months = 12; const 比 #define 更好,因为首先,明确了类型;其次,可以使用 C++ 的作用域规则将常量限定在某个函数或文件中;最后,可用于复杂类型。