sort one array and other array following?

后端 未结 3 718
北海茫月
北海茫月 2021-01-28 23:28

here is the C++ sample

int a[1000] = {3,1,5,4}
int b[1000] = {7,9,11,3}

how do i make it so if i sort array a, array b also following array a

3条回答
  •  借酒劲吻你
    2021-01-29 00:03

    Instead of using two arrays, can you use an array of pairs and then sort THAT using a special comparison functor rather than the default less-than operator?

提交回复
热议问题