6_19.cpp

来自「C++语言程序设计案例教程,郑莉编的书」· C++ 代码 · 共 12 行

CPP
12
字号
#include <iostream>
using namespace std;
int main()
{	int n=44;
	//int& rn=55; 			//错误:55不是一个变量!
	int& rn=n;  				//rn 是变量 n的别名
	cout << "The value of n is: " << n << ", The value rn is: " << rn << endl;
	--n;  	cout << "The value of n is: " << n << ", The value rn is: " << rn << endl;
	rn *= 3;	cout << "The value of n is: " << n << ", The value rn is: " << rn << endl;
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?