如果数组内排序一段区间就是这样
va[1] = 2,va[2] = 10,va[3] = 5,va[4] = 1,va[5] = 5;
int l = 2,r = 4;
sort(va+l,va+r+1);
for(int i=1;i<=5;i++) cout<<va[i]<<" ";
sort一段区间
最新推荐文章于 2024-08-17 21:22:45 发布
如果数组内排序一段区间就是这样
va[1] = 2,va[2] = 10,va[3] = 5,va[4] = 1,va[5] = 5;
int l = 2,r = 4;
sort(va+l,va+r+1);
for(int i=1;i<=5;i++) cout<<va[i]<<" ";