Computer Science Canada Removing an item in an array |
| Author: | atrain [ Thu Mar 03, 2005 11:16 pm ] |
| Post subject: | Removing an item in an array |
i have to make a program which keeps track of things... I want things to be added and subtracted... i hear a flexible array can let the array be added to, but can i delete arrayvar (2) and have everything else shift down?? im willing to move everything down, then delete the last one 2... so how would i go about doing this? (adding + subtracting) |
|
| Author: | jamonathin [ Fri Mar 04, 2005 6:59 am ] | ||
| Post subject: | |||
Also look under tutorials under high score for more help on this. |
|||
| Author: | Bacchus [ Fri Mar 04, 2005 7:01 am ] |
| Post subject: | |
read the flexible array tutorial on how to delete certain parts of it. its by Cervantes and he explain how to do that very well |
|
| Author: | atrain [ Fri Mar 04, 2005 1:04 pm ] |
| Post subject: | |
where is this tutorial that you speakith of? |
|
| Author: | Tony [ Fri Mar 04, 2005 1:49 pm ] |
| Post subject: | |
atrain wrote: where is this tutorial that you speakith of?
Internet -- same place where every other Turing tutorial is. |
|
| Author: | atrain [ Fri Mar 04, 2005 4:44 pm ] |
| Post subject: | |
k, i see how to do it... thanks all!!! 1 other question: if i set new Array, current - 1 then it will properly delete an item?? |
|
| Author: | Tony [ Fri Mar 04, 2005 5:18 pm ] |
| Post subject: | |
Exactly. If you need to get rid of an item in an array, just swap it with the last element and decrease the size by one. |
|
| Author: | atrain [ Sun Mar 06, 2005 4:41 pm ] |
| Post subject: | |
yup it works fine... Thanx soo much now only problem is my program is so huge, it doesnt have enougf memory to indent!!! stupid wine!!! |
|
| Author: | McKenzie [ Sun Mar 06, 2005 4:43 pm ] |
| Post subject: | |
Turing will also stop indenting if you have even a single line that is too long. Check for that before you give up on the auto-indent. |
|
| Author: | Bacchus [ Sun Mar 06, 2005 5:52 pm ] |
| Post subject: | |
copy selections of the code and paste them into a new turing file to indent it then just copy and paste that back into the main file. always did that at school and worked just fine |
|
| Author: | atrain [ Sun Mar 06, 2005 7:53 pm ] |
| Post subject: | |
by ine that is too long, do you mean like a loop / if statment inside a loop inside a loop and on and on, so that the indent would be huge or the line has 2 much text on it, and i have to split it up if possible??? i manualy indented it this time, but my code will just continue growing... i got rid of all big lines... my program is 453 lines long... |
|
| Author: | Cervantes [ Sun Mar 06, 2005 8:18 pm ] |
| Post subject: | |
There shouldn't be any problem with 453 lines. Probably you've got some really long lines. Try splitting them up. |
|
| Author: | atrain [ Thu Mar 10, 2005 10:03 pm ] |
| Post subject: | |
ive split up long lines... im pritty sure it has to do with the fact that im on wine... i wish theyed make a version of turing for linux already (i hear there is one, but not sure how resent it is..) |
|