7_4.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:0k
源码类别:

C#编程

开发平台:

Visual C++

  1. //7_4
  2. void Swap(int& a, int& b){ int temp=a; a=b; b=temp; }
  3. void Bsort(int a[], int n)
  4. {
  5.   bool dontLoopAgain=false;
  6.   while(dontLoopAgain=!dontLoopAgain)
  7.     for(int i=0,pass=--n; i<n; i++)
  8.       if(a[i]>a[i+1]){
  9.         dontLoopAgain=false;
  10.         Swap(a[i],a[i+1]);
  11.       }
  12. }