5个数按从小到大排列,还差点什么
#include<iostream>
using namespace std;
int main()
{
int n1,n2,n3,n4,n5;
int *p1,*p2,*p3,*p4,*p5,p;
cout<<"请输入五个整数:"<<endl;
cin>>n1>>n2>>n3>>n4>>n5;
p1=&n1;
p2=&n2;
p3=&n3;
p4=&n4;
p5=&n5;
if(n1>n2)
{
p=*p1;
*p1=*p2;
*p2=p;
}
if(n2>n3)
{
p=*p2;
*p2=*p3;
*p3=p;
}
if(n3>n4)
{
p=*p3;
*p3=*p4;
*p4=p;
}
if(n4>n5)
{
p=*p4;
*p4=*p5;
*p5=p;
}
if(n1>n5)
{
p=*p1;
*p1=*p5;
*p5=p;
}
cout<<n1<<" "<<n2<<" "<<n3<<" "<<n4<<" "<<n5;
return 0;
}