#include<iostream>
using namespace std;
int main(int argc, char *argv[])
{
int arr[10] = { 1,2,5,7,4,3,9,8,6,0 };
for (size_t i = 0; i < 10-1; i++)
{
for (size_t j = 0; j < 10-i; j++)
{
if (arr[j] < arr[j+1])
{
int temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
for (int i = 0; i < 10; i++)
{
cout << arr[i];
}
cout << endl;
system("pause");
return 0;
}
C++冒泡排序
最新推荐文章于 2024-07-13 21:02:20 发布