迭代器

1.基本操作

#include<iostream>
#include<string>
#include<fstream>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<sstream>
#include<algorithm>
using namespace std;
//

int main(int argc,char *argv[]){
    string line;
    vector<string>v;
    while (getline(cin, line)){
        v.push_back(line);
        for (auto i = v.begin(); i != v.end() && !i->empty(); i++){
            for (auto &c : *i)
                c = toupper(c);
            cout << *i<< endl;
        }
    }
    system("pause");
    return 0;
}

 

posted @ 2017-12-14 14:16  bananaa  阅读(99)  评论(0编辑  收藏  举报