Home > Back-end >  The following code is written by myself, can achieve the sorting, but always feel it's a bit st
The following code is written by myself, can achieve the sorting, but always feel it's a bit st

Time:05-12

#include
using namespace std;

Void busort (int * a, int n)
{
Int I, j, temp.
For (I=0; I & lt; N - 1; I++)
For (j=I + 1; J & lt; n; J++)
If (a [I] & gt; A [j])
{
Temp=a, [I].
A [I]=a, [j].
A [j]=temp;
}
}

Int main ()
{
35,89,61,135,78,29,50,13 int a []={};
Int len=sizeof (a)/sizeof (a [0]);
Busort (a, len);
for (int i=0; I & lt; Len. I++)
cout system("pause");
return 0;
}

CodePudding user response:

I hope it can help you, looking forward to adopt: https://blog.csdn.net/it_xiangqiang/category_10768339.html

CodePudding user response:

Bubble sort
  • Related