I have an array of integer data like value and I need to insert a new Integerdata in the array. I have thought of creating a temporary array to copy all the contents and then creating a new array with a size + 1 root, but I am getting many errors. Any help? Since you are using C ++, I instead have a vector I recommend using: Otherwise in C, the function can behave like this: (assuming that the way you have class completion data: public data {public: intestine value; // It is the syntax for a constructor that starts the integer data value for the parameter // property value: value {}} class ArrayCollection: collection {// value of value is always equal to the calculation data * * Values; integer number; Public: ArrayCollection () {// array zero to this-> value = faucet; This- & gt; Number = 0; } ~ ArrayCollection () {// Here the array allocated internally here must be cleaned if (values! = NULL) {delete values]; }} / ** * Calculates the number of elements in the collection * / integer size () const {return calculation; } / ** * Returns the data value on the specified index. If index & gt; = Size () then * NULL is returned * / data * get (int index) {if (index> = size ()) {return NULL; } And {return value [index]; }} ???? - I need help for this method - // I try to allocate the recurrent dynamically, but I am getting an error message: // can not enter the intangible type of data 'data' zero (data * Other) {Count ++; Data ** tempArray = new data [count]; For (int i = 0; i
std :: vector & lt; Data * & gt; Vect; ... enter zero (data * other) {vect.push_back (other); }
values Arrays were allocated in the past, the space does not allow for dynamic resizing ...)
values_tmp (count ++) <
values_tmp [count] = Other;
value with new array:
value = values_tmp;
No comments:
Post a Comment