首页 > 代码库 > 汉字拼音排序

汉字拼音排序

#include <iostream>#include <string>#include <vector>#include <algorithm>using namespace std;int main(int argc, char* argv[]){string s("中航光电系空方克星股市震荡的安全港湾或引业绩突增");vector<string> vs;for(unsigned i=0;i<s.length();i+=2)vs.push_back(s.substr(i,2));sort(vs.begin(),vs.end());vector<string>::iterator it=vs.begin();for(;it!=vs.end();it++)cout<<*it;cout<<endl;system("pause");return 0;}