#include <iostream>
#include <string>
#include <vector>
using namespace std;
/*
**vector<string> name
**如题!!
**
**如何使用 sort函数给string 排序!!
*/
void sort( vector<string> name )
{
string temp;
for(vector<string>::iterator ip = name.begin(); ip != name.end(); ++ip )
{
temp = *ip;
for( vector<string>::iterator iq = ip+1; iq != name.end(); ++iq )
if( temp > *iq )
{
*ip = *iq;
*iq = temp;
}
}
for(vector<string>::iterator s = name.begin(); s != name.end(); ++s )
cout<< *s<<' ';
cout<<endl;
}
int main()
{
string temp;
vector<string> name;
int i;
cout<<"输入字符串的个数:";
cin>>i;
while( i-- )
{
cout<<"输入字符串:";
cin>>temp;
name.push_back(temp);
}
sort( name );
return 0;
}