常量-常量与变量的区别-常量的使用

- 常量不可更改
- const修饰的变量也称为常量
点击查看代码
#include<iostream>
#include<string>
using namespace std;
//常量的定义方式
// 1、#define宏常量
#define WEEK 7
// 2、const修饰的变量,const修饰的变量也称为常量
const int month = 12;
int main()
{
cout << WEEK << "天" << endl;
cout << month << "月" << endl;
system("pause");
return 0;
}

浙公网安备 33010602011771号