When I compile the code above, I get this error "no match for 'operator=' in 'grid2[1][1] = 5' ". I'm clueless as to what's the problem... Thx!Code:#include <iostream> #include <math.h> #include <vector> using namespace std; int main (void) { int sv = 0, fv = 0; cout << "Start Value:" << endl; cin >> sv; cout << "End Value:" << endl; cin >> fv; cout << endl; int size = (int)sqrt(fv-sv)+5; vector <vector<int> > grid [size][size]; vector <vector<int> > grid2 [15][15]; int midx = (int)(sqrt(fv-sv)+5/2)-1, midy = (int)(sqrt(fv-sv)+5/2)-1; int down = 0, right = 0, left = 0, up = 0; int yy = 0, xx = 0; int count = 0; string dir = "down"; for (int i = 0; i <= 5 ; i++) { if (dir=="down") { for (int i2 = 0; i2 < 1 ; i2++) { grid2[1][1] = 5; grid[0][0] = 5; grid [midx][midy] = i; } dir = "right"; } } }
31 C:\Documents and Settings\Administrator\Desktop\Testing Files Folder\J42001.cpp no match for 'operator=' in 'grid2[1][1] = 5'
note C:\Dev-Cpp\include\c++\3.4.2\bits\vector.tcc:131 candidates are: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>:perator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<int, std::allocator<int> >, _Alloc = std::allocator<std::vector<int, std::allocator<int> > >]
32 C:\Documents and Settings\Administrator\Desktop\Testing Files Folder\J42001.cpp no match for 'operator=' in 'grid[0][0] = 5'