Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 450 Bytes

8-4-函数入门-结构体数组排序.md

File metadata and controls

25 lines (17 loc) · 450 Bytes

对结构体数组排序

对结构体数组进行排序。

题目描述:

struct Person{
  int no;
  int age;
  int height;
}

实现sort方法对结构体数组进行排序。

void sort(Person * array,int n);

根据no从小到大排序;如果no相同则根据age排序;如果age相同,则根据height排序。

注意:

遇到异常情况,输出"error";否则不要随意输出,会视为错误。