Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <list>
- #include <time.h>
- #include <cstdlib>
- #include <iterator>
- #include <deque>
- #include <string>
- #include <stack>
- using namespace std;
- int main(){
- /*
- list <int> list_1 , list_2;
- list <int> ::iterator it;
- for(int i = 1; i<=4; ++i){
- list_1.push_back(i);
- }
- for (int i = 1; i<=3 ; ++i){
- list_2.push_back(i*10);
- }
- it= list_1.begin();
- ++it;
- list_1.splice(it, list_2);
- list_2.splice(list_2.begin(),list_1,it );
- it = list_1.begin();
- advance(it,3);
- list_1.splice(list_1.begin(), list_1, it, list_1.end());
- cout << "List 1: ";
- for(it=list_1.begin() ; it !=list_1.end(); ++it)
- cout<<" " << *it;
- cout<<endl;
- for(it = list_2.begin() ; it!=list_2.end() ; ++it)
- cout << " " << *it;
- cout<<endl;
- */
- /* srand(time(0));
- list <int> l1,l2;
- for(int i = 0 ; i<=10 ; i++){
- l1.push_back(rand() % 89+10);
- l2.push_back(rand() % 89+10);
- }
- ostream_iterator <int> out (cout, " ");
- cout << "List 1: " << endl;
- copy (l1.begin() , l1.end(), out);
- cout << "\nList 2: "<<endl;
- copy (l2.begin() , l2.end(), out);
- l1.sort();
- l2.sort();
- cout << endl << endl << "List 1 : ";
- copy (l1.begin() , l1.end(), out);
- cout<<endl << "List 2: ";
- copy (l2.begin() , l2.end(), out);
- l1.merge(l2);
- cout << endl << "\nAll: ";
- copy (l1.begin() , l1.end(), out);
- */
- /*
- deque<char> dq;
- char szBuffer[80];
- cin.getline(szBuffer, 80);
- for(int i = 0; i < strlen(szBuffer); i++)
- dq.push_back(szBuffer[i]);
- while(true) {
- if((dq.back() == dq.front() && dq.size() > 1)) {
- dq.pop_back();
- dq.pop_front();
- } else {
- if(dq.empty() || dq.size() == 1)
- cout << "Palindrom\n";
- else
- cout << "Not a Palindrom\n";
- break;
- }
- } // end while
- */
- deque<int> dq(10);
- auto sz = dq.size();
- for(unsigned int i = 0; i < sz; i++) {
- dq[i] = i;
- }
- for(unsigned int i = 0; i < sz / 2; i++) {
- int temp;
- temp = dq[sz-1-i];
- dq[sz-1-i] = dq[i];
- dq[i] = temp;
- }
- cout << "mydeque contains: ";
- for(unsigned int i = 0; i < sz; i++) {
- cout << " " << dq[i];
- }
- cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement