#include <iostream>
#include <algorithm>
using namespace std;
struct baby {
int age;
}bb[6];
void test01()//赋值
{
bb[1] = { 8 };
bb[2] = {2};
bb[3] = {3};
bb[4] = {5};
bb[5] = {6};
bb[0] = {9};
}
bool cmp(baby a, baby b)//bool类型的函数
{
return a.age < b.age; //返回真则不交换,返回假则交换
}
int main()
{
test01();
sort(bb,bb+6,cmp);//注意不包含bb+6,即右边是开区间
return 0;
}