摘要:
源程序: #include <iostream> using namespace std; int main() { int a1 = 3; const int a2 = a1; //数据a2是常量 int *a3 = &a1; //普通指针指向普通变量 const int *a4 = &a1; / 阅读全文
posted @ 2019-12-02 15:22
bobo哥
阅读(133)
评论(0)
推荐(0)
摘要:
源程序: #include <iostream> using namespace std; int oneX = 10; int oneY = 20; int &refValue(int &x) { return x; } int main() { refValue(oneX) = 30;//返回值 阅读全文
posted @ 2019-12-02 15:06
bobo哥
阅读(132)
评论(0)
推荐(0)
摘要:
源程序: #include <iostream> using namespace std; void SwapValue(int a, int b) { int tmp; tmp = a; a = b; b = tmp; cout << "在SwapValue()函数中:\t\ta=" << a < 阅读全文
posted @ 2019-12-02 11:38
bobo哥
阅读(257)
评论(0)
推荐(0)
摘要:
源程序: 各种数据类型的转换 #include <iostream> using namespace std; int main() { const int cInt = 30; int oneInt = 50; int &ref = oneInt; const int &rc1 = cInt; c 阅读全文
posted @ 2019-12-02 11:29
bobo哥
阅读(110)
评论(0)
推荐(0)
摘要:
源程序: using namespace std; int main() { int oneInt = 1; int &ref = oneInt; const int &refc = oneInt; //定义常引用 ref = 2; //修改ref也即修改了oneInt cout << "oneIn 阅读全文
posted @ 2019-12-02 11:19
bobo哥
阅读(119)
评论(0)
推荐(0)
摘要:
源程序: #include <iostream> using namespace std; void func(int a = 11, int b = 22, int c = 33) { cout << "a=" << a << ",b=" << b << ",c=" << c << endl; } 阅读全文
posted @ 2019-12-02 10:42
bobo哥
阅读(135)
评论(0)
推荐(0)
摘要:
源程序: #include <iostream> using namespace std; int main() { int a = 10; const int *p = &a; const int ca = 30; int *q; cout << "a的地址为:\t" << &a << "\ta的 阅读全文
posted @ 2019-12-02 10:35
bobo哥
阅读(139)
评论(0)
推荐(0)
摘要:
源程序: #include <iostream> #include <string> using namespace std; int main() { int oneInt1, oneInt2; char strArray[20]; string str; double oneDouble; ch 阅读全文
posted @ 2019-12-02 09:14
bobo哥
阅读(193)
评论(0)
推荐(0)

浙公网安备 33010602011771号