指针这样exchenge

#include <iostream>
using namespace std;
int main()
{int a,b;
 int *p1,*p2,*p;
 cin>>a>>b;
 p1=&a;
 p2=&b;
 if(*p1<*p2)
 {p=p1;
  p1=p2;
  p2=p;
 }
 cout<<endl;
 cout<<*p1<<" "<<*p2<<endl;
 return 0;
posted @ 2012-12-18 19:41  _一千零一夜  阅读(114)  评论(0编辑  收藏  举报