c++变量的使用

/*#include<iostream>
#include<iomanip>
#include<stdlib.h>
using namespace std;

int main()
{
 system("color 3E");
 int a=10;
 int &b=a;
 a=a*a;
 cout<<a<<" "<<b<<endl;
 b=b/5;
 cout<<a<<" "<<b<<endl;
 return 0;
}*/

#include<iostream>
#include<iomanip>
#include<stdlib.h>
using namespace std;
void swap(int &a,int &b)
{
 int tem;
 tem=a;
 a=b;
 b=tem;
}

int main()
{
 system("color 3E");
 int i=3,j=5;
 swap(i,j);
 cout<<i<<" "<<j<<endl;
 int a=8,b=520;
 const int &c=b;
// c=3;
 cout<<c<<endl;
 b=b+a;
 cout<<b<<endl;

 int t=9;
    const int &n=t+9;
 cout<<n<<endl;
 return 0;
}

原文链接: https://www.cnblogs.com/wangjie2/archive/2012/10/26/2741187.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    c++变量的使用

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/67135

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月9日 下午12:41
下一篇 2023年2月9日 下午12:41

相关推荐