那楼主的意思应该是可以用algorithm里的sort函数,此函数可以进行高效排序

程序代码:
#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;
struct cnbeta
{
int date , start , time;
}cn[100];
int cmp(const struct cnbeta &a , const struct cnbeta &b) //自定义的sort的比较函数
{
if(a.date == b.date)
if(a.time == b.time)
return a.start < b.start; //比较通话开始时间,按从小到大排
else
return a.time < b.time; //从小到大排通话时间
return a.date < b.date; //从小到大排日期
}
int main()
{
int i;
cn[0].date = 1; cn[0].time = 2; cn[0].start = 3;
cn[1].date = 1; cn[1].time = 1; cn[1].start = 3;
cn[2].date = 2; cn[2].time = 3; cn[2].start = 4;
sort(cn,cn+3,cmp); //对数据排序
for (i = 0; i < 3 ; i++)
cout << cn[i].date << " " << cn[i].time << " " << cn[i].start << endl;
system("pause");
return 0;
}