10 2021 档案
摘要:1、cerr freopen cout输出到文件内时,cerr能输出到控制台显示 2、cin.getline() defalut -> '\n' #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #include<bits
阅读全文
摘要:1、this指针的运用 指向当前函数作用类的指针 相当于翻译为C语言,r.run() = run(test * this) #include<bits/stdc++.h> using namespace std; class test{ private: double real,imag; publ
阅读全文
摘要:1、 成员函数可写在类的外面 #include<bits/stdc++.h> using namespace std; class student{ public: int grade; string name; void init_(string _name,int _grade){ name =
阅读全文
摘要:1、引用 #include<bits/stdc++.h> using namespace std; void swap(int &a,int &b){ int temp = a; a = b; b = temp; } void swap(int *a,int *b){ int temp = *a;
阅读全文
摘要:1、vector sort 的降序 vector<int> v; // 其sort降序 bool cmp(int a,int b){ return a>b; } sort(v.begin(),v.end(),cmp); //去重 sort(vt.begin(),vt.end()); vt.erase
阅读全文