3.常量

2020-12-07  本文已影响0人  lxr_

#include<iostream>

using namespace std;

//常量的定义方式

//1.#define 宏常量

//2.const修饰的变量

#define Day 7

int main()

{

    //Day = 7;    //常量不可修改

    cout << "一周有" << Day << "天" << endl;

    const int month = 12;

    //month = 24;     //不可修改

    cout << "一年有" << month << "月" << endl;

    system("pause");

    return 0;

}

上一篇 下一篇

猜你喜欢

热点阅读