![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
函数
不优雅的函数我不写。
「已注销」
zhtsu
展开
-
C++整型转字符串
string toString(int num) { string res = ""; while (num % 10) { res += (num % 10 + '0'); num /= 10; } // #include <algorithm> reverse(res.begin(), res.end()); return res;}原创 2021-10-09 19:31:43 · 750 阅读 · 0 评论 -
链表操作函数集合(C++)
反转单向链表void ReverseList(Node* head) { //反转带头节点指针的单向链表 Node* pre = NULL; Node* cur = head->next; Node* nex = cur->next; while (cur != NULL) { cur->next = pre; pre = cur; cur = nex; nex = (nex == NULL) ? NULL : nex->next; } hea原创 2020-12-06 17:55:45 · 222 阅读 · 3 评论 -
排序技术函数集合(C++)
插入排序void insert_sort(int arr[], int length) { for (int i = 1; i < length; i++) { int temp = arr[i]; int j; for (j = i; arr[j - 1] > temp && j > 0; j--) { arr[j] = arr[j - 1]; } arr[j] = temp; }}原创 2020-11-21 16:07:42 · 133 阅读 · 0 评论