泼点冷水: new失败后的处理不符合C++标准,为无用代码! 欲知详情,请自行搜索“C++ new 失败”。 建议对此说明...
2016-03-18
#include <iostream>
using namespace std;
int main(void)
{
int x = 3;
//定义引用,y是x的引用
int &y=x;
//打印x和y的值
cout << x << endl;
cout << y << endl;
//修改y的值
y = 3;
//再次打印x和y的值
cout << x << "," << y << endl;
return 0;
}
using namespace std;
int main(void)
{
int x = 3;
//定义引用,y是x的引用
int &y=x;
//打印x和y的值
cout << x << endl;
cout << y << endl;
//修改y的值
y = 3;
//再次打印x和y的值
cout << x << "," << y << endl;
return 0;
}
#include <iostream>
using namespace std;
int main(void)
{
int x = 3;
int &y =x;
cotu<< x <<","<<y<<
y = 3;
return 0;
}
using namespace std;
int main(void)
{
int x = 3;
int &y =x;
cotu<< x <<","<<y<<
y = 3;
return 0;
}