需要帮助..请告诉我为什么“ A.clear() ”也没有清除第一列?..................................................... ……
#include <iostream>
#include <vector>
using namespace std;
int N, M;
vector< vector<int> > A;
int main()
{
cin >> N >> M;
A.resize(N + 2);
for (int i = 0; i <= N; ++i)
{
A[i].resize(M + 2);
}
A.clear();
for (int i = 0; i <= N; ++i)
{
for (int j = 0; j <= M; ++j)
{
cout << A[i][j] << ' ';
}
cout << '\n';
}
return 0;
}