0 Reputation Points
Unknown Quality Score
No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
1 Posted Topic
Re: String function
[code=cplusplus] #include <iostream> #include <vector> #include <algorithm> #include <iomanip> #include <string> using namespace std; bool compare(string s1,string s2) { if(strcmp(s1.c_str(),s2.c_str())>0) return true; else return false; } int main() { string a[]={"abc","dafa","eeee","what"}; vector<string> names(a,a+4); // increasing alphabetical sequence sort(names.begin(),names.end()); for(vector<string>::const_iterator itr=names.begin();itr<names.end();itr++) { cout<<*itr<<" \t"; } cout<<endl; // decreasing alphabetical sequence sort(names.begin(),names.end(),compare); …
The End.
gay bird