两个容器中的数据合并

来源:互联网 发布:国外域名代理商 编辑:程序博客网 时间:2024/05/18 02:55


俩个容器中的数据合并

#include<iostream>#include<set>#include<string>using namespace std;int main(){string phone;set<string> A;set<string>::iterator p;for (int i = 0; i < 2; i++){getline(cin, phone);while(phone!="end"){A.insert(phone);getline(cin, phone);}}p = A.begin();while (p != A.end())cout << *p++ << endl;return 0;}


原创粉丝点击