Here's the problem:
I have almost everything done, except the data structure and sorting part. I'm trying to set up a linked list to store the information input by the user and sort them from there, so I wrote this:First your program will ask the user how manys names will be inputed. Number of names will not exceed 100. Then ask the user for the names. Names will be in the format of "Last,First,age" with nospaces and there will always be three fields. Assume the user will always use this format. The names string will be at most 40 characters. After the user has inputed the names, ask how are they to be sorted. They are sorted by either last, first, or age. Then print the names out in sorted order. For people who have the same last name, sort by first name. For people with the same age, sort by last name and if that is also the same sort by first name. For people with the same first name, sort by last name. No two people will have the same first and last name.
The question is: will that kind of linked list work and am I going to be able to do the sorting part with it? Thanks.Code:struct person { char last_name[40]; char first_name[40]; int age; }; struct node { struct person; struct node *next; };



LinkBack URL
About LinkBacks


