Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Adding/Removing Array Values
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Artimes




PostPosted: Wed Nov 10, 2004 5:40 pm   Post subject: Adding/Removing Array Values

I'm creating a database like program in class. My program provides up to 20 employees to a fake company with their names, hours worked, salery, and pacycheck in a table. I have a sorting algoryth that does just what it says. Sorts the values from greatest to least, you have the option which values you which to sort them by... My problem is when you remove someone from the lost I set their values to either 0 or " ", depending on the array type. Well the numbers all get shoved to the bottom and accual you just don't see... But the names... A space comes before "A", therefore at the top is the deleted person. Is there a way I can just remove the values or resize the array without reseting all the extensions on the array? (i.e. variables (1) := 1 etc)

I can get the program to work backwards (as in the least values appear at the top)
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Nov 10, 2004 11:15 pm   Post subject: (No subject)

there are multiple approaches you can take

1 - sort in opposite direction, such as replace < with > in your condition

2 - set nonexistant person's name to something like chr(255)+"gone" to garantee it will be alphaberically last

3 - use a flexable array to actually just delete unneeded element
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: