16週種目4:指来指去(2)

734 ワード

/*
*             
* Copyright (c)2012,            
* All rightsreserved.
*     : array.cpp
*       :   
*     :2012 12 13 
*    : v1.0
*     :  
*     :   ,      ,   ;
*/
#include <iostream>
using namespace std;
void jiaohuan(int *p1,int *p2);
int main( )
{
	int *p1,*p2,a,b;
	cout<<"      (a,b):"<<endl;
	cin>>a>>b; 
	jiaohuan(&a,&b);
	cout<<"   :a="<<a<<"  b="<<b<<endl;
	return 0;
}
void jiaohuan(int *p1,int *p2)
{
	int t;
	t=*p1;
	*p1=*p2;
	*p2=t;
}