C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 8th, 2013, 10:05 AM
oussamaboun oussamaboun is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 10 oussamaboun User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 27 m 19 sec
Reputation Power: 0
I neeed help plz about linked list.

hello to everyonee first iu want to thank all the persons who are here for helping and teaching us . you are doing great job .
i neeed i help to creat this functions in c programming because i am not good in this langauge i am doing my best to lurn this language and be better than i am now. thanks .


Create a file where you have all the necessary information about persons.
A person is known by his name, surname, sex, date of birth (day, month, year), an ID (5 character eg P0001), the number of children.
All persons will be stored in a linked list.
Functions to do:
- Load the data file into a list of persons (using a structure person).
- Add a person in the list.
- Add the children of a person.
- Remove a person from the list.
- Consult the list of persons.
- Search for a person by name or surname.
- View the number of children of the person given in parameter.
- Return the age of a person.
- Modify the records of a person (update).
- Sort the list according to the person's name and ID.
- Save list data in file.
- Add useful functions if necessary.

Creating a menu for functions.

Reply With Quote
  #2  
Old January 8th, 2013, 02:08 PM
dwise1_aol's Avatar
dwise1_aol dwise1_aol is offline
Contributing User
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 6,134 dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 3 Days 20 h 49 m 9 sec
Reputation Power: 1974
Use divide and conquer. Take the large task and break it up into its component small tasks, each of which do basically one thing and hence is easy to do. Ideally, each small task will be performed by one function.

Start by defining the structure of the node, what its fields are and what its pointer fields will point to. I would assume that this is a simple single-linked list, so you'd have a single pointer field pointing to the next node.

Work out how to create a new person node. Then work out how to add/insert this new node into the list. Is it an ordered list (ie, are the nodes sorted in some kind of order?)? What field are you sorting on? -- I would assume the ID field.

Work out how to delete a node.

Both inserting and deleting imply that you be able to search the list for a particular node. Finding a particular person's node to modify/update it also requires that you be able to find it. A preliminary step in figuring out how to find a particular node would be the ability to traverse the list node-by-node, so an early simple task to implement would be to traverse the list and print out information about that person in the order you encounter them; this will also be useful as a way to verify that you're inserting them in the right order and that you're removing the right one, etc.

When working with linked lists, it's often useful to sketch diagrams of the operations you're trying to perform so that you can work out the steps and details of the task before you start coding it.

After you have implemented the basic functions, then the solution to the other tasks on your list will be more apparent.

Reply With Quote
  #3  
Old January 8th, 2013, 04:02 PM
oussamaboun oussamaboun is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 10 oussamaboun User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 27 m 19 sec
Reputation Power: 0
thanks for the ideaaa ..but i would better know to save it in a file and load it form it ??

Reply With Quote
  #4  
Old January 8th, 2013, 07:42 PM
dwise1_aol's Avatar
dwise1_aol dwise1_aol is offline
Contributing User
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 6,134 dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level)dwise1_aol User rank is General 15th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 3 Days 20 h 49 m 9 sec
Reputation Power: 1974
That's called serialization. It won't do you any good to write pointers to a file, of course. A simple solution would be to write the node data files out to the file in the order that those nodes occur in the list, then when you read the file back in, you simply re-create the list with the nodes in the order that you read them in.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > I neeed help plz about linked list.

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap