code [1]

When compiling (1) gives (2). What to do? How to fight?

    2 answers 2

    You cannot apply an indexing operator to a vector that does not yet have elements.

    Therefore, you should write before the cycles

    cin >> str; cin >> stb; vect.resize(str, std::vector<int>(stb)); 

    That is, you first need to create the elements of the vector, and then only refer to them by index.

      As an initialization option (you can specify the dimension during creation):

       int a,b; cin>>a>>b; vector<vector <int> > mas(a,vector<int>(b)); size_t size = mas.size(); for(size_t i = 0; i < size; ++i){ for_each(mas[i].begin(),mas[i].end(),[](int& k){cin>>k;}); }