64,643
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
#include <string>
using namespace std;
template<typename T>
void swap(T& a,T& b){
T temp=a;
a=b;
b=temp;
}
int main(){
double dx=1.22,dy=2.11;
int ix=11,iy=22;
string s1="abc",s2="def";
swap(dx,dy);
cout<<dx<<dy<<endl;
swap(ix,iy);
cout<<ix<<iy<<endl;
cout<<s1<<s2<<endl;
system("pause");
}