#include <iostream>
#include<vector>
using namespace std;
void sort(vector<int>& a)
{
const int size =a.size();
int temp;
int flag=1;
while(flag==1)
{
flag = 0;
for(int i =0;i<size;++i)
{
if(a[i]>a[i+1])
{
temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
flag=1;
}
}
if(flag==0)
break;
}
}
int main() {
int a,b,c,d,e,f;
cin>>a>>b>>c>>d>>e>>f;
vector<int> arr = {a,b,c,d,e,f};
sort(arr);
for(int j =0;j<arr.size();++j)
{
cout<<arr[j]<<" ";
}
return 0;
}
标签:arr,temp,int,C++,flag,vector,冒泡排序,size From: https://blog.csdn.net/m0_63632131/article/details/140354551