#include<bits/stdc++.h>
using namespace std;
int main(){
    array<int,5> a1 = {1,2,3,4,5};
    array<int,5> a2 = {10,20,30,40,50};
    for(int i=0;i<5;i++){
        cout<<a1[i]<<" ";
    }
    cout<<"\n";
    for(int i=0;i<5;i++){
        cout<<a2[i]<<" ";
    }
    cout<<"\nafter swapping two arrays using swap() function\n";
    a1.swap(a2);    
    for(int i=0;i<5;i++){
        cout<<a1[i]<<" ";
    }
    cout<<"\n";
    for(int i=0;i<5;i++){
        cout<<a2[i]<<" ";
    }
    cout<<"\n";
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: