![]() |
| | #1 |
| Registered User Join Date: Apr 2009
Posts: 1
| C++ Linked list program need help !!! Question Details: - write a C++ program that will manipulate data stored in a self-organizing linked list. A self –organizing list moves frequently used entries to the beginning of the list. This program will be inputting data from files, writing and calling functions, using a linked list, and outputting data to a file. use only one linked list. - The infotype in this problem will consist of a name (string), a phone number (string) and a counter (int). Whenever a phone number is looked up, one is added to the counter for that node. Datafile “friends.txt” contains lines of the following format: <name> <phone number > Data items are separated by blanks. Each line of file “Lookup.txt” contains a name. - Store the data from file “friends.txt” in a linked list using pointers. The order of items in the list should be the same as the order in the file. After the list is created, print out the linked list. - For each entry from “Lookup.txt”, search the linked list for the input name. Print to the screen the name and phone number. Print a message for names that are not found. In addition, increment the counter in the node. If the counter in a node becomes 3, reset the counter to zero and move that entry to the beginning of the list. - After all entries from “Lookup.txt” are processed, print out the list of names, phone numbers and counters to the screen. Also, create an output file containing the list of names, phone numbers, and counters. - Use functions to accomplish each task. Use function prototypes. Declare the main function before you declare additional functions. - Print an error message if the either input file is missing. friends.txt file Brite,Brenda 410-123-4567 Carpenter,Candace 410-123-4444 Delray,Don 410-123-5555 Ellis,Ellen 410-123-9876 Fink,Fred 410-123-8765 Popular,Pat 410-123-6666 Jenkins,Jan 337-471-1111 Hacker,Harry 888-123-3333 Hacker,Horatio 888-321-6543 Hacker,Henry 888-321-6544 Hacker,Henrietta 888-321-6545 Hacker,Hillary 888-321-6543 Zappa,Zeke 888-345-5555 Kruella,Karen 888-345-9999 Martens,Max 800-234-7777 Rabbitz,Lucky 999-333-1111 Overton,Oscar 410-471-2222 Wallace,Wally 888-555-5656 Hacker,Hortense 888-321-6546 Yodler,Yancy 410-742-8888 Miles,Morticia 410-543-0444 Lookup.txt file Popular,Pat Hacker,Harry Popular,Pat Fink,Fred Zappa,Zeke Hacker,Harry Brite,Brenda Popular,Pat Delray,Don Delray,Don Popular,Pat Zappa,Zeke Wallace,Wally Popular,Pat Kruella,Karen Brite,Brenda Kruella,Karen Hacker,Harry Brite,Brenda Missin,Marvin Kruella,Karen Popular,Pat Brite,Brenda Hacker,Harry Findem,Kenya Hacker,Henrietta |
| dcoll025 is offline | |
| | #2 |
| Making mistakes Join Date: Dec 2008
Posts: 347
| First try a normal linked list. Then add elements such as priority. I can only give hints, but Do your homework on your own |
| Brafil is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| single linked list to double linked list (help) | Countfog | C Programming | 8 | 04-29-2008 08:04 PM |
| Adding directory/file names to a linked list | thoseion | C Programming | 13 | 12-08-2006 01:13 PM |
| Please Help - Problem with Compilers | toonlover | C++ Programming | 5 | 07-23-2005 10:03 AM |
| How can I traverse a huffman tree | carrja99 | C++ Programming | 3 | 04-28-2003 05:46 PM |
| Array, Linked List, or Binary Tree? | Unregistered | C Programming | 6 | 01-05-2002 10:07 PM |