建议用指针
我给你重写了
// temp.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include
using namespace std;
template
void swap(T *a,T *b) //交换函数
{
T *temp;
temp = a;
a = b;
b = temp;
}
void show(int a,int b) //显示函数
{
cout<<"i = "<cout<<"j = "<}
int main() //主函数
{
int i = 11,j = 22;
cout<<"交换前:"<
swap(i,j); //交换i和j
cout<<"交换后:"<
return 0;
}