![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
STL学习
在河之洲
这个作者很懒,什么都没留下…
展开
-
由一段代码说开去——set
#include //包含了set类#include #include using namespace std;struct Info{ string name; float score; bool operator<(const Info &a)const//默认按照less排列 所以你需要写上这个操作符重载 { return scor原创 2013-11-26 14:23:31 · 660 阅读 · 0 评论 -
由一段代码说开去——vector
1 #include //包含cin cout 2 #include //包含向量 vector 3 #include //包含算法 accumulate 4 #include //包括stl的很多算法 5 #include 6 using namespace std; 7 bool cmp(const int &a,const int &b)//这里参数类型要是cons原创 2013-11-26 14:23:25 · 809 阅读 · 0 评论 -
由一段代码说开去——string
#include //包含string类#include #include #include #include //#include //字符串流using namespace std;int main(){ string a,b; char c[10]="拜拜"; a="ab c";//把c字符串赋值给string对象 a.appen原创 2013-11-26 14:23:27 · 582 阅读 · 0 评论 -
由一段代码说开去——sscanf与string
1 #include 2 #include //大概是字符串流 3 #include string> 4 using namespace std; 5 6 //c++方法 将double数值 转换成string对象 7 string convertToString(double x) 8 { 9 ostringstream o;10 if(o//将原创 2013-11-26 14:23:29 · 1887 阅读 · 0 评论 -
由一段代码说开去——list
1 #include //双向循环链表 2 #include 3 #include 4 using namespace std; 5 int main() 6 { 7 listint> L; 8 L.push_back(2); 9 L.push_back(1);10 L.push_back(5);11 //尾部元素扩张12 L原创 2013-11-26 14:23:33 · 701 阅读 · 0 评论 -
POJ 1001 解题报告 高精度大整数乘法模版
有用的c++函数总结find()函数; string成员函数有这个,algorithm库中也有这个 ,可以在容器中查找元素string的at函数,比如string str; str.at(pos)能够检查越界 比 str[pos] 安全。当然你可以根据自己的需求选择使用哪一种表示方式,但是在c中你就没的选erase函数可以选择性地删除字符串中一部分,我们可以想见其效率有多慢,但是总比自己写代码要爽insert函数 就是插入函数 reverse函数 反转字符串的一部分 是algorithm库原创 2015-01-06 16:24:39 · 4227 阅读 · 6 评论