算法c++之stl---set基本使用

it2023-11-07  75

#include<bits/stdc++.h> using namespace std; set<string> dict; //string集合 int main(){ string s,buf; int n =4; while(n--){ cin>>s; dict.insert(s); } //遍历set集合 for(set<string>::iterator it=dict.begin();it!=dict.end();++it){ cout<<*it<<"\n"; } return 0; }
最新回复(0)