跳到正文

个人记录

sort排序

zzd_start_gay约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟
获赞
1

版本

  1. v1当前

#include<bits/stdc++.h>

using namespace std;

bool cmp(int a,int b)

{

if(a>b)

return true;

else

return false; }

int main()

{

int a[5]={3,2,1,5,4};

C++
int n=5;

sort(a,a+n);//1>>

//sort(a,a+n,cmp);//2>>

for(int i=0;i<n;i++)

cout<<a[i]<<” ”;

return 0; }

原文