if i have a file with names in it in this manner:
John : Bob
Mike : Joe
Mark : John
Bob : Ted
I want the program to read in the file and seperate the names, that is done. However, I am stuck on how to insert the names in to a list based on whether they have been previously read. Basically, I want to comprise little lists and make one big list.
Here are the 3 situations I do not know how to code:
1. if one name appears in an existing little list, add it to the other list that has that name as well.
2. if both names appear in an existing list, connect the two lists.
3. if neither name appears in a list, form a a new list with the two names.
I need an iterator to do this, but I am unsure how to code the IF statements?
Please, any help and advice is greatly appreciated!
Can you clarify your problem? Do you simply want to make a list of names from the file with every name appearing only once? Or is it some more complex structure that you want the final structure to have? Can you give the results of that example?
Sounds like homework. Post your code with specific problems, and we'll be glad to help.
And be sure to use code tags.