Revision: 63600
Updated Code
at May 21, 2013 16:35 by zaxbbun
Updated Code
// solution one
//
template <class T>
void swap(T *a, T *b){
*a = *a + *b;
*b = *a - *b;
*a = *a - *b;
}
// solution two
//
template <class T>
void swap(T &a, T &b){
a = a * b;
b = a / b;
a = a / b;
}
Revision: 63599
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 21, 2013 16:26 by zaxbbun
Initial Code
template <class T>
void swap(T *a, T *b){
*a = *a + *b;
*b = *a - *b;
*a = *a - *b;
}
Initial URL
Initial Description
swap: swap two numbers without using the third object( or variable)
Initial Title
swap: swap two numbers without using a third object( or variable)
Initial Tags
Initial Language
C