c++学习笔记02--变量与常量

1.变量的定义与输出

#include <iostream>
using namespace std;

int main() {

	int a = 10;
	cout << "a =  "<< a << endl;
	system("pause");


	return 0;
}

2.常量的定义与输出

    常量定义两种方法

    • 宏定义
    • const定义
#include <iostream>
using namespace std;
#define a 50

int main() {


	cout << "a =  "<< a << endl;
	const int b = 60;
	cout << "b =  " << b << endl;
	system("pause");


	return 0;
}

 

posted @ 2022-06-08 13:53  (⊃・ᴥ・)つ  阅读(22)  评论(0编辑  收藏  举报