Home > Back-end > Use vector to realize two dimensional array interpolation problem, ask for advice
Use vector to realize two dimensional array interpolation problem, ask for advice
Time:09-25
Vector Arr. Arr. Resize (dat_num + 1);//to a frame data reset container lines, equivalent to add a line; Arr [dat_num]. Resize (12);//initialize a new line of space Vector a; for(int j=0; j<12. J++) Amy polumbo ush_back (dbv1 [j]);//an array to be included in the container a Arr. Insert (arr. The begin (), a. do v.begin (), a.e nd ());//insert a to the beginning of the arr??????? Dat_num + +; Originally I want to use the vector to realize a number of two-dimensional arrays, each invocation is to increase the two-dimensional array arr a line, and then put the dbv1 this one-dimensional array into the arr [0] [I] the first line of the original data in turn up, why I use the arr. Insert (arr. The begin (), a. do v.begin (), a.e nd ()); T insert data, using arr. Push_back (a) is inserted into the last column also not line? Pray god give directions? Draw back when I used arr [I] when [j] we found all is 0.
CodePudding user response:
Arr. Insert (arr. The begin (), a);
CodePudding user response:
Arr. Insert (arr. The begin (), a);
Use the insert and the push_back are increased a row Using the resize is pre-allocated good size, so you need to arr way [I] [j] such assignment I hope it can help you