文章分类 -  visual c++ 程序设计

visual c++ 程序设计
摘要:1.引用做函数参数的注意点 1 #include <iostream> 2 using namespace std; 3 void show(int& ref) 4{ 5 cout << ref << endl; 6 } 7 void show01(const int& mRef) 8 { 9 co 阅读全文
posted @ 2025-02-13 00:12 java帝国 阅读(2) 评论(0) 推荐(0)
摘要:普通引用 1.做函数参数,替代指针 2.做函数的返回值 引用指针 1 #include <iostream> 2 using namespace std; 3 void mswap(int a, int b) 4 { 5 int temp; 6 temp = a; 7 a = b; 8 b = te 阅读全文
posted @ 2025-02-12 23:29 java帝国 阅读(5) 评论(0) 推荐(0)
摘要:引用:顾名思义就是一个变量或对象的别名,定义引用的操作与其所绑定的变量或对象的操作完全等价 1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 /* 6 引用:顾名思义就是一个变量或对象的别名,定义引用的操作与其所绑定的变量 阅读全文
posted @ 2025-02-12 22:15 java帝国 阅读(3) 评论(0) 推荐(0)
摘要:/* 功能:new和delete 时间:2025年2月12日15:25:51 **/ #include<iostream> using namespace std; void showArr(int* arr, int len) { for (int i = 0; i < len; i++) { c 阅读全文
posted @ 2025-02-12 17:23 java帝国 阅读(9) 评论(0) 推荐(0)
摘要:1.C++变量的初始化 #include<iostream> using namespace std; int main() { // 第一种:使用赋值运算符初始化 int age = 18; //第二种: char say[10] = { 'A','B' }; //C++奇葩的初始化方式 { in 阅读全文
posted @ 2025-02-12 16:29 java帝国 阅读(8) 评论(0) 推荐(0)
摘要:/* 功能:命名空间的内联问题 时间:2025年2月7日17:35:42 **/ #include<iostream> using namespace std; namespace Version { inline namespace v2017 //inline 内联:表示namespace v2 阅读全文
posted @ 2025-02-07 17:39 java帝国 阅读(5) 评论(0) 推荐(0)