Vector,List及Deque

#include <iostream>
#pragma   warning (disable: 4786)
#include <vector>
#include<string>
#include<list>
#include<deque>

using namespace std;

int main()
{
   
    vector<string>ivec;
    ivec.push_back("I");
    ivec.push_back("am");
    ivec.push_back("a");
    ivec.push_back("very");
    ivec.push_back("nice");
    ivec.push_back("Chinese!");

    for(vector<int>::size_type ix=0;ix<4;ix++)
    {
        cout<<(ivec[ix])<<endl;
    }
    list<string> slist(ivec.begin(),ivec.end());
    vector<string>::iterator mid=ivec.begin()+ivec.size()/2;
    //deque<string> deOne;
    //deOne.insert("I");
    //deOne.insert("man");
    deque<string> front;
    front.push_back("I");
    front.push_back("am");
    front.push_back("Jack");

    //deque<string> back(mid,ivec.end());
    for(list<string>::iterator itr=slist.begin();itr!=slist.end();itr++)
    {
        cout<<*itr<<endl;
    }
    for(deque<string>::iterator ditr=front.begin();ditr!=front.end();ditr++)
    {
        cout<<*ditr<<endl;
    }
   

    return 0;
}

你可能感兴趣的:(Vector,List及Deque)