顯然這不起作用,所以代碼是錯誤的,但我該如何解決它? 這整個事情可能是錯誤的,我知道所有大聲笑,但我試圖創建一個多維向量,在運行時創建自己。我收到一個錯誤:vector subscript out of range
。在運行時填充多維向量
#include <iostream>
#include <vector>
int main(){
int row = 0, col = 0;
std::cout << "Size of Row: "; std::cin >> row;
std::cout << "Size of Column: "; std::cin >> col;
std::vector<std::vector<int>> td;
td.resize(row * col);
for (int i = 0; i <= row; i++){
for (int j = 0; j <= col; j++){
td[i][j];
}
}
}