#include <stdio.h>
template <typename Type>
void Swap(Type& one, Type& another);
int main()
{
template <typename Type>
void Swap(Type& one, Type& another);
int main()
{
int N = 5, M = 10;
Swap(N, M);
printf("N = %d, M = %d\n", N, M);
double dN = 5.0, dM = 10.0;
Swap(dN, dM);
printf("dN = %f, dM = %f\n", dN, dM);
return 0;
Swap(N, M);
printf("N = %d, M = %d\n", N, M);
double dN = 5.0, dM = 10.0;
Swap(dN, dM);
printf("dN = %f, dM = %f\n", dN, dM);
return 0;
}
template <typename Type>
void Swap( Type&, one, Type& another)
{
template <typename Type>
void Swap( Type&, one, Type& another)
{
Type temp;
temp = one;
one = another;
another = temp;
temp = one;
one = another;
another = temp;
}
'아카이브' 카테고리의 다른 글
| [SQL] Update + Select (0) | 2009.06.05 |
|---|---|
| TMemo 컨트롤 사용시 스크롤바 자동으로 내리기 (0) | 2009.05.28 |
| WM_SYSCOMMAND 가 보이지 않을떄 (0) | 2008.12.02 |
| MFC Dialog 기반 OnDraw 적용 (0) | 2008.11.24 |
| 컴퓨터 부팅이 안될때...먼저 확인해 볼 것!! (5) | 2008.08.22 |