
C++
、Edgar
Coding with fun
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
linux下使用getaddrinfo获取相关地址信息
/* 使用getaddrinfo获取主机对应的相关数据 */ #include <iostream> #include <netdb.h> #include <string.h> #include <iomanip> #include <netdb.h> #include <arpa/inet.h> using std::cout; using std::dec; using std::endl; using std::hex;原创 2021-04-24 08:53:07 · 798 阅读 · 0 评论 -
C++ vector 初始化大小
一维数组 使用下面的代码可以初始化一个大小为n的一维数组 vector<int> dp(n); 二维数组 使用下面的代码可以初始化一个row 行col列的二维数组 vector<vector<int>> dp(row, vector<int>(col)); 三维数组 使用下面的代码可以初始化一个三维数组,维度分别为n1, n2, n3 vector<vector<vector<int>>> dp(n1, vector&原创 2021-04-12 15:46:43 · 4314 阅读 · 0 评论 -
C++实现五种排序方式
插入排序 #include <iostream> using std::cout; using std::endl; void printArr(int arr[], int n) { for (int i = 0; i < n; i++) { cout << arr[i] << "\t"; } cout << endl; } void insert_sort(int arr[], int n) { printArr(ar原创 2021-03-28 09:23:09 · 360 阅读 · 0 评论