呵呵 也能按字母排名
#include <iostream>
#include <string>
using namespace std;
string str1,str2,str3,z;
int main()
{void exchenge(string *a,string *b);
string *a,*b,*c;
cin>>str1>>str2>>str3;
a=&str1;
b=&str2;
c=&str3;
exchenge(a,b);
exchenge(a,c);
exchenge(b,c);
cout<<str1<<endl;
cout<<str2<<endl;
cout<<str3<<endl;
return 0;
}
void exchenge(string *a,string *b)
{if(*a>*b)
{z=*a;
*a=*b;
*b=z;
}
#include <string>
using namespace std;
string str1,str2,str3,z;
int main()
{void exchenge(string *a,string *b);
string *a,*b,*c;
cin>>str1>>str2>>str3;
a=&str1;
b=&str2;
c=&str3;
exchenge(a,b);
exchenge(a,c);
exchenge(b,c);
cout<<str1<<endl;
cout<<str2<<endl;
cout<<str3<<endl;
return 0;
}
void exchenge(string *a,string *b)
{if(*a>*b)
{z=*a;
*a=*b;
*b=z;
}