//常量定义有两种方式
//define定义宏常量 const修饰变量
#include<iostream>
using namespace std;
#define Day 7 //define 只能一次定义 后面不能再赋值
int main() {
cout << "there is" << Day << "in a week" << endl ;
//const 定义一个不能改变的变量 但是可以把变量的值赋予给其他变量
const int month = 12 ;
cout<<"there is"<<month
system("pause");
return 0;
}
CPP_day3_[黑马]
C++中的常量定义:宏常量与const变量的区别,
最新推荐文章于 2025-12-12 16:37:00 发布
669

被折叠的 条评论
为什么被折叠?



