void swap(int& a, int& b)
{ int t = a; a = b; b = t;}

void bubble_sort(int* a, const int N)
{
    for(int j=0; j<N-1; j++){
        for(int i=0; i<N-1; i++){
            if(a[i]>a[i+1]) swap(a[i],a[i+1]);
        }

    }
}
void show(int* a, const int N)
{
    for(int i=0; i<N; i++) cout << a[i] << " ";
    cout << endl;
}
老师可以解释注释一下 这一段吗


相关课程:C++特训班>第一阶段:基础篇>基础篇>函数进阶

©2014-2023 百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备13018289号-12    营业执照    经营许可证:京B2-20212637