Hi guys, i`m currently trying to implement a 2d vector to store x and y of type int.
i have successfully passed it to the function, however i am unable to store the values in it. It always returns with a segementation fault and my program terminates from there. May i know how do i store them properly and call them out?
below is my code snippet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
int reconstructSecret(int x, int y, vector< vector<int> > &inVec ,int constructSecret)
the main method
1 2 3 4 5 6 7 8 9 10 11
vector< vector<int> > inVec;
cout<<"please key in the "<<i<< "share of x value:";
cout<<"please key in the "<<i<< "share of y value:";
Did you try creating a temporary container outside that's initialized with your variables and then push that to your inVec? I'm pretty sure trying to call any constructor straight up is not good, though I don't remember why.