swap

it2022-05-05  90

代码 #include  < iostream > using   namespace  std; void  swap( int   * i, int   * j){     int  temp  =   * i;     * =   * j;     * =  temp;} void  swap2( int   & i, int   & j){     int  temp  =  i;    i  =  j;    j  =  temp;} int  main(){     int  a  =   10 ,b  =   20 ;    swap(a,b);    cout << a << "   " << b << endl;    swap2(a,b);    cout << a << "   " << b << endl;     return   0 ;}

 

 

转载于:https://www.cnblogs.com/ManMonth/archive/2010/09/03/1817360.html


最新回复(0)