#include <iostream>
#include <string.h>
void swap(int &a, int &b)
{
int t = a;
a=b;
b=t;
}
void swap(float &a, float &b)
{
float t = a;
a=b;
b=t;
}
void swap(string &a, string &b)
{
string t = a;
a=b;
b=t;
}
int main()
{
int a1,b1;
float a2,b2;
string a3,b3;
cout<<"è¾å
¥ä¸¤ä¸ªæ´æ°";
cin>>a1>>b1;
swap(a1,b1);
cout<<"交æ¢ç»æ "<<a1 <<' '<< b1<<endl;
cout<<"è¾å
¥ä¸¤ä¸ªæµ®ç¹æ°";
cin>>a2>>b2;
swap(a2,b2);
cout<<"交æ¢ç»æ "<<a2 <<' '<< b2<<endl;
cout<<"è¾å
¥ä¸¤ä¸ªå符串";
cin>>a3>>b3;
swap(a3,b3);
cout<<"交æ¢ç»æ "<<a3 <<' '<< b3<<endl;
return 0;
}
温馨提示:答案为网友推荐,仅供参考