#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;
}
'아카이브' 카테고리의 다른 글
| CodeGear C++ Builder 2009 - Cannot convert 'WideString' to 'wchar_t *' 문제해결 (0) | 2009.06.24 |
|---|---|
| 델파이 및 C++ 빌더 파일 확장자 비교 (0) | 2009.06.24 |
| 컴퓨터 부팅이 안될때...먼저 확인해 볼 것!! (5) | 2008.08.22 |
| Update Panel Control Trigger (0) | 2008.07.15 |
| A와 B의 합집합 구하기 (0) | 2007.10.29 |