index.cpp 运行失败是怎么回事
index.cpp
index.cpp
2017-12-05
#include <iostream>
using namespace std;
/**
* 定义模板函数swapNum
* 实现功能:交换两个数的位置
*/
template <typename T,class C>
void swapNum(T &a,C &b)
{
T temp = a;
a = b;
b = temp;
}
int main(void)
{
int x = 10;
int y = 20;
// 调用模板函数
swapNum <int,int>(x,y);
cout << "x = " << x << endl;
cout << "y = " << y << endl;
return 0;
}
//运行成功的
举报