First of all, don't hard-code your 10, this makes the code completely unsupportable. Ever heard of constants? Do you understand that it could be a variable?
As to the code, it looks correct, but who knows what is
stdVec
, where it is declared? You should not ask anything about some unknown part of the code. Believe or not, but because of late spring and massive snow melting, my access to your hard drive is somewhat limited. If you declare
stdVec
correctly as an instance of
std::vector
of
int
, your code will work correctly. Please see:
http://www.cplusplus.com/reference/vector/vector/[
^].
Should be something like
#include <vector>
using namespace std;
vector<int> stdVec;
Just for some fun, please see this CodeProject article:
Arrays in C++/CLI[
^].
—SA