64,654
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <string>
using namespace std;
void swap(string &s1,string &s2)
{
string temp;
temp=s1;
s1=s2;
s2=temp;
}
int main()
{
string a("hello");
string b("world");
swap(a,b);
cout<<a <<endl <<b <<endl;
return 0;
}