摘要: View Code 1 #include<iostream> 2 #include<bitset> 3 #include<string> 4 5 using namespace std; 6 7 int main() 8 9 {10 11 bitset<32> a;//a可以放32位二进制12 13 cout << a <<endl;14 15 16 bitset<16> b(0xffff);//1111 1111 ...17 18 cout << b << endl;19 20 bit 阅读全文
posted @ 2012-03-27 23:36 uniquews 阅读(280) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<iostream> 2 #include<queue> 3 4 int main() 5 { 6 7 using namespace std; 8 9 priority_queue<int,vector<int>> pq;//默认是vector 最大值优先级队列10 11 //谓词12 priority_queue<int,deque<int>,greater<int>> pq2; //加上greater 就是最小值优先级队列13 14 pq.push(10);15 p 阅读全文
posted @ 2012-03-27 23:32 uniquews 阅读(158) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<iostream> 2 #include<queue> 3 #include<list> 4 #include<deque> 5 6 //queue不能用vector 7 //队列和堆栈都不能修改数据的值,没有迭代器 8 9 using namespace std;10 11 12 int main()13 {14 queue<int, deque<int>> a;15 queue<int,list<int>> b;16 queue<int> q 阅读全文
posted @ 2012-03-27 23:31 uniquews 阅读(789) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include <iostream> 2 #include<stack> 3 #include<vector> 4 #include<list> 5 6 using namespace std; 7 8 9 int main()10 11 {12 13 stack<int,deque<int>> a;14 stack<int,vector<int>> b;15 stack<int,list<int>> c;16 stack<int> d; 阅读全文
posted @ 2012-03-27 23:30 uniquews 阅读(158) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include <iostream> 2 #include<set> 3 4 using namespace std; 5 typedef multiset<int> MSETINT;//set插入比vector稍慢 他不是顺序容器 不能再找到数据后直接修改,需删除后再添加新数据。 6 int main() 7 { 8 9 MSETINT a;10 11 a.insert(43);12 a.insert(78);13 a.insert(78);14 a.insert(-1);15 a.insert(124);1... 阅读全文
posted @ 2012-03-27 23:29 uniquews 阅读(122) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include <iostream> 2 #include<set> 3 4 5 using namespace std; 6 7 8 template <typename Container>//原因是 a 和ma 的类型不一样,所以要做成模板函数 container还可以显示vector等 9 void PrintContents(const Container & c);10 11 12 int main()13 {14 15 16 set<int> a;//set容器会自动进行排序17 multiset& 阅读全文
posted @ 2012-03-27 23:28 uniquews 阅读(126) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<iostream> 2 #include<list> 3 4 5 using namespace std; 6 7 void PrintListContent(const list<int>& listInput); 8 9 int main()10 {11 12 std::list<int> a;13 14 a.push_front(5);15 a.push_front(9);16 a.push_front(21);17 a.push_front(16);18 a.push_front(8);. 阅读全文
posted @ 2012-03-27 23:27 uniquews 阅读(128) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<iostream> 2 #include<list> 3 4 using namespace std; 5 6 void PrintListContent(const list<int>& listInput); 7 8 int main() 9 {10 11 12 std::list<int> a;13 a.push_front(4);14 a.push_front(3);15 16 list<int>::iterator iElementValueTwo;17 18 iElemen 阅读全文
posted @ 2012-03-27 23:25 uniquews 阅读(127) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include <iostream> 2 #include<list> 3 4 using namespace std; 5 6 void PrintListContent(const list<int>& listInput); 7 8 int main() 9 {10 11 12 13 list<int> a;14 list<int> b;15 list<int>::iterator iter;16 17 b.push_back(100);18 b.push_back(200);19 阅读全文
posted @ 2012-03-27 23:23 uniquews 阅读(152) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<iostream> 2 #include<deque> 3 #include<algorithm> 4 5 int main() 6 7 { 8 using namespace std; 9 10 deque<int> a;11 12 a.push_back(3);13 a.push_back(4);14 a.push_back(5);15 16 a.push_front(2);17 a.push_front(1);18 a.push_front(0);19 20 for(size_t nCount = 阅读全文
posted @ 2012-03-27 23:19 uniquews 阅读(162) 评论(0) 推荐(0) 编辑