#include<iostream>
using namespace std;
int main()
{
void sort(int &x,int &y,int &z);
int a,b,c;
cin>>a>>b>>c;
sort(a,b,c);
cout<<"The sorted number:"<<endl;
cout<<a<<" "<<b<<" "<<c<<endl;
return 0;
}
void sort(int &x,int &y,int &z)
{
void swap(int &i,int &j);
if(x>y) swap(x,y);
if(x>z) swap(x,z);
if(y>z) swap(y,z);
}
void swap(int &i,int &j)
{
int t;
t=i;
i=j;
using namespace std;
int main()
{
void sort(int &x,int &y,int &z);
int a,b,c;
cin>>a>>b>>c;
sort(a,b,c);
cout<<"The sorted number:"<<endl;
cout<<a<<" "<<b<<" "<<c<<endl;
return 0;
}
void sort(int &x,int &y,int &z)
{
void swap(int &i,int &j);
if(x>y) swap(x,y);
if(x>z) swap(x,z);
if(y>z) swap(y,z);
}
void swap(int &i,int &j)
{
int t;
t=i;
i=j;
j=t;
}
C++ 排序算法示例

被折叠的 条评论
为什么被折叠?



