Home > Back-end >  Please teach a great god, array redefine what to write? Thank you very much!
Please teach a great god, array redefine what to write? Thank you very much!

Time:09-23

This is I want to write functions:
Functional prototypes: array space. Redefine (arrar, iscopy, len1=0, len2=0, len3=0, len4=0, len5=0, len6=0, len7=0, len8=0)
Function description: redefining the size of the array, and returns a new array, iscopy to really change the array size and copy the data, is false you just change the array size and do not copy data,
The code I wrote:

Long * ShuZhuChongDingYi (long * h2, bool bool_cdy, int xiabiao)
{
//if the definition is true, you change the array size and copy data
If (bool_cdy)
{
//STR. Resize (xiabiao + 1);//resetting the container size
STR. Push_back (h2/xiabiao);//because began from 0, so let it + 1, in the tail to a data
//TRACE (" window handle arrays content=% d \ n ", STR [xiabiao]);
TRACE (" window handle array number=% d \ n ", STR., the size ());//returns the number of actual data, the container
for (int i=0; i {
TRACE (" array % d=% d \ n ", I, STR [I]);
The h2=STR [I] [I];
}

}
//if the weight is defined as false, it is just change the array size, do not copy data
The else
{
//increase the length of the array
STR. Resize (xiabiao);//resetting the container size
}
TRACE (" subscript=% d \ n ", xiabiao);
//return a new array
Return the h2;
}

Today got a day, lane is bad, great god give advice or comments, please. Thank you!
  • Related