![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
杂谈
Achanss
My life is good, and u just make it better!
展开
-
常用的函数形参,实参传递
首先, 给出接触C语言来的第一次函数参数传递遇到的bugvoid swap(int x,int y) //自动建立新的临时变量作为形参,与实际值无关{ int temp; temp=x; x=y; y=temp;}int main(){ int a = 5, b = 3; swap(a,b); return 0;}由于传递的是形参,不会改变a,b的值!要改变a,...原创 2019-08-04 23:22:00 · 409 阅读 · 0 评论 -
Vector 的简单用法
/** @Author: Achan* @Date: 2019-04-06 22:39:50* @Last Modified by: Achan* @Last Modified time: 2019-04-06 23:22:19*/#include<bits/stdc++.h>using namespace std; inline bool cmp(int a,...原创 2019-04-06 23:24:04 · 207 阅读 · 0 评论 -
CodeBolcks使用小技巧
CodeBlocks 快速注释多行Ctrl + Shift + C快速取消注释Ctrl + Shift + X原创 2019-04-06 19:07:01 · 456 阅读 · 0 评论 -
C++ char[] 与string 的相互转换
string 转 char[] string str=“world”;const char *p = str.c_str();//注意要加const !!!char[] 转 stringstring s;char *p = "hello";s = p; //直接赋值附上使用scanf() printf() 又能方便运用stri...原创 2018-10-09 19:46:24 · 4839 阅读 · 0 评论 -
C++ 中 string 的简单用法
string + string #include<iostream>using namespace std;int main(void){ string s,sap; cin>>s; cin>>sap; s+=sap; //方法一 s.append(sap); //方法二 cout&l...原创 2018-09-30 19:06:22 · 318 阅读 · 0 评论 -
C++ unique() 去重函数的简单用法
#include<bits/stdc++.h>using namespace std;int main(void){ int a[10] = {5,33,1,0,54,12,213,5,3,7}; sort(a,a+10); //必须排序,只去重相邻相同元素 ! int n = unique(a,a+10) - a; //unique(arr,arr +...原创 2018-10-02 09:58:20 · 1784 阅读 · 0 评论 -
优先队列 的操作符重载 priority_queue <node> q
/** @Author: Achan* @Date: 2019-03-30 23:03:36* @Last Modified by: Achan* @Last Modified time: 2019-03-30 23:09:04*/#include<bits/stdc++.h>using namespace std;struct node{ int...原创 2018-10-01 22:28:10 · 880 阅读 · 0 评论