#includeusing namespace std; int main () { //1.swap int val int x=10, y=20; // x:10 y:20 swap(x,y); //x:20 y:10 cout << "x = " << x << "x = " << y << endl; //2.swap str val int foo[4] = {1,2,3,4}; int bar[] = {10,20,30,40}; swap(foo,bar); //foo: 10,20,30,40; bar:1,2,3,4, cout << "foo: "; for(int i: foo) cout << ' ' << i; cout << endl; cout << "bar: "; for(auto i: bar) cout << ' ' << i; return 0; }



