摘要: //例子引自c++标准程序库P157页,见有会员问,我还硬是把这些代码重新敲了一次,最近也在自学stl,就当练习一下,注释全部翻译成中文了,希望能够帮到你#include <iostream>#include <vector>#include <string>#include <algorithm>using namespace std;int ma... 阅读全文
posted @ 2010-04-13 22:10 蓝牙 阅读(276) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <string>using namespace std;int main(int argc,char** argv){const string delims(" \t,.;");string line;while(getline(cin,line)){string::size_type begIdx,endIdx;be... 阅读全文
posted @ 2010-04-13 20:23 蓝牙 阅读(248) 评论(0) 推荐(1) 编辑
摘要: #include <bitset>#include <iostream>#include <string>#include <limits>using namespace std;int main(){cout<<"267 as binary short: "<<bitset<numeric_limits<unsi... 阅读全文
posted @ 2010-04-13 19:25 蓝牙 阅读(139) 评论(0) 推荐(0) 编辑
摘要: #ifndef STACK_HPP#define STACK_HPP#include <deque>#include <exception>template <class T>class stack{protected:std::deque<T> c;public:class ReadEmptyStack : public std::bad_exce... 阅读全文
posted @ 2010-04-13 18:54 蓝牙 阅读(199) 评论(0) 推荐(0) 编辑
摘要: #include "algostuff.hpp"//见http://www.cnblogs.com/qnbs1/articles/1709197.htmlusing namespace std;int main(){vector<int>coll;INSERT_ELEMENTS(coll,3,7);INSERT_ELEMENTS(coll,3,9);INSERT_ELEMENTS(co... 阅读全文
posted @ 2010-04-13 14:18 蓝牙 阅读(1508) 评论(0) 推荐(0) 编辑