Add and delete items from arrays 
Author Message
 Add and delete items from arrays

Hello,

I have two arrays.
Now I want to add one item inside array two from array one.
After that I delete the copied item from array one.

Can somebody give me an example?

I have tried a lot of times now but I still get errors with indexes, memory etc.

Thanks for your help and advice!



Wed, 06 Jul 2005 01:49:46 GMT  
 Add and delete items from arrays



Quote:
> Hello,

> I have two arrays.
> Now I want to add one item inside array two from array one.
> After that I delete the copied item from array one.

> Can somebody give me an example?

> I have tried a lot of times now but I still get errors with indexes,
memory etc.

> Thanks for your help and advice!

Best show us your attempts, so we can comment on it.
We want to see how the array is declared and the algorithms for
inserting and deleting.

Normally (in pseudo code)
for inserting one item
-check if there is room in the array, if necessary add more room or
places
-move all the items one position down, starting with the last item
working back to the insert position, so array element i+1 gets the value
of element i
-insert the item.

For deleting
-move all the elements one position up starting at insert position+1 to
the end

Dont forget to adjust the counter that stores the number of elements in
the array

If you know how to work with object oriented programming you might want
to check out TCollection.

--
Femme



Wed, 06 Jul 2005 03:49:39 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. help adding and deleting records from arrays

2. Way to add and delete from arrays??????

3. adding/deleting records from array of records in .dat file

4. Adding List Items From Database Fields

5. Adding new items to DBLookupCombo

6. Add Listview Items to comboboxes

7. Database Basic Add/Amend/Delete

8. Add and delete columns in a dbgrid

9. Q: Problem with adding/deleting fields

10. add/delete dbf record in pascal

11. add/delete dbf record in pascal

12. How to add/delete user to SQL Server from Delphi

 

 
Powered by phpBB® Forum Software