Operator overloading

Firstly, Format your code.
Either do this

    for(const auto &vec : a){
        for(const auto &c : vec){
            cout<<c<<" ";
        }
        cout<<'\n';
    }

or
declare this at the top of your code

ostream& operator<<(ostream& out, const vector<vector<int>> &vec){
    for(int i=0;i<vec.size();i++){
        for(int j=0;j<vec[i].size();j++){
            out<<vec[i][j]<<" ";
        }
        out<<'\n';
    }
    return out;
}

Then you can type this

cout<<a;
4 Likes