📜  使用内置排序函数按降序对数组进行排序 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:46.395000             🧑  作者: Mango

代码示例1
// Sort(In Ascending Order) Array using Inbuilt Sort function
sort(arr, arr+n);
  
// Sort(In Ascending Order) Vector using Inbuilt Sort function
sort(arr.begin(), arr.end());

// Sort(In Descending Order) Array using Inbuilt Sort function
sort(arr, arr+n, greater())
  
// Sort(In Descending Order) Vector using Inbuilt Sort function
sort(arr.begin(), arr.end(), greater())