#include <iostream>
using namespace std;
int main(void)
{
//定义常量count
const int count = 3;
const int *p = &count;
//打印count次字符串Hello C++
for(int i = 0; i < count; i++)
{
cout << "Hello imooc" << endl;
}
return 0;
}
using namespace std;
int main(void)
{
//定义常量count
const int count = 3;
const int *p = &count;
//打印count次字符串Hello C++
for(int i = 0; i < count; i++)
{
cout << "Hello imooc" << endl;
}
return 0;
}
最新回答 / TTshuanger
重载函数与默认参数重叠导致的二义性问题 func(int); //重载函数1,只有1个参数,无默认参数 func(int a, int b =4); //重载函数2,有2个参数,有1个默认参数 func(int a=3, int b=4, int c=6); //重载函数3,有3个参数,有3个默认参数出现二义性,fun(1,2)会编译失败的。
2017-06-20
#include <iostream>
using namespace std;
int main(void)
{
int x = 3;
//定义引用,y是x的引用
int &y = x;
//打印x和y的值
cout<<"x = "<<x<<" y = "<<y<<endl;
//修改y的值
y = 8;
//再次打印x和y的值
cout<<"x = "<<x<<" y = "<<y<<endl;
return 0;
}
using namespace std;
int main(void)
{
int x = 3;
//定义引用,y是x的引用
int &y = x;
//打印x和y的值
cout<<"x = "<<x<<" y = "<<y<<endl;
//修改y的值
y = 8;
//再次打印x和y的值
cout<<"x = "<<x<<" y = "<<y<<endl;
return 0;
}