//我写的一个简单的使用C++ sort的例子,供你参考
#include
#include
typedef struct _TestSortArray
{
char _arrStr[16];
}TestSortArray;
int main()
{
TestSortArray tsa;
tsa._arrStr[15] = 0;
char a = 'z';
for (int i = 0;i < 15; ++i)
{
tsa._arrStr[i] = a;
--a;
}
std::cout << "Previous string is:" << tsa._arrStr << std::endl;
std::sort(tsa._arrStr,tsa._arrStr + 15);
std::cout << "After sort,string is:" << tsa._arrStr << std::endl;
system("pause");
return 0;
}