본문 바로가기
Programming/C++

Function Template /

by OKOK 2017. 10. 18.

Function template 

 #include <iostream>


using namespace std;


template<typename T>

void Swap(T& num1, T& num2)

{

T temp = num1;

num1 = num2;

num2 = temp;

}


int main()

{

int num1 = 10, num2 = 40;

cout << "before. num1: " << num1 << ", num2: " << num2 << endl;

Swap(num1, num2);

cout << "after. num1: " << num1 << ", num2: " << num2 << endl;


system("pause");

return 0;

}





console 창 유지

project -> propertise -> linker -> system -> subsystem -> console


https://blog.bsk.im/2013/10/24/visual-studio-console-remained/