//---------------------------------------------------------------------------
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma argsused
#include
#include
using namespace std;
int data[]={2,8,7,6,9,1,5,0};
int main(int argc, char* argv[])
{
int length = sizeof(data)/sizeof(int);
int i=0;
while(i < length-1)
{
int j =0;
while(j < length-1-i)//每一轮找出最大值,从数组尾部往前放
{
if(data[j] > data[j+1])
{
int temp = data[j];
data[j] = data[j+1];
data[j+1]= temp;
}
++j;
}
++i;
}
for(int i=0;i
新闻名称:C语言冒泡排序
文章路径:http://cxhlcq.com/article/gjdgis.html