源代码:#include<iostream>#include<vector>#include<algorithm>#include<iterator>using namespace std;//function solveint*solve(int n, int m){vector<int>a;vector<int>b;vector<int>c;int ptrOFc = 0;for (int i = 0; i < n+1; i++){a.push_back(i);}while (m < n){int t = n--;c[ptrOFc++] = a[m];a.erase(remove(a.begin(), a.end(), a[m]));for (int i = 1; i < n - m + 1; i++)b = a[m++];for (int i = 1; i < m; i++)b.push_back(a);a = b;}copy(c.begin(), c.end(), ostream_iterator<int>(cout," "));return &c[0];}int main(){solve(10, 2);return 0;}编译器报错:0x5ED4A893 (msvcr120d.dll) (ConsoleApplication1.exe 中)处有未经处理的异常: 将一个无效参数传递给了将无效参数视为严重错误的函数。PS:请高手看一下,是我使用vector容器的方法有误,还是VS软件的问题
添加回答
举报
0/150
提交
取消