文章目录 在结构体外在结构体内 在结构体外 struct node { int l; int r; } a[N]; bool cmp(node x,node y) { return x.l <y.l ; } sort(a,a+m,cmp); 这样子的排序就是升序 在结构体内 struct node{ int l,r; bool operate<(const node &x)const{ retunr l<x.l; } }a[1005]; 同样也是升序哦!