Input : set1 = {1, 2, 3, 4}
set2 = {5, 6, 7, 8}
set1.swap(set2);
Output : set1 = {5, 6, 7, 8}
set2 = {1, 2, 3, 4}
Input : set1 = {'a', 'b', 'c', 'd'}
set2 = {'w', 'x', 'y', 'z'}
set1.swap(set2);
Output : set1 = {'w', 'x', 'y', 'z'}
set2 = {'a', 'b', 'c', 'd'}
int main()
{
int a = 5;
int b = 10;
swap(a, b);
cout << "a = " << a << endl;
cout << "b = " << b << endl;
}
int a, b;
cout << "Input first number: ";
cin >> a;
cout << "Input second number: ";
cin >> b;
swap (a, b);
cout << "After swapping the first number: " << a << endl;
cout << "After swapping the second number: " << b << endl;