Thread View: csu.cs.200
3 messages
3 total messages
Started by Chris Vaughn-Uding
Wed, 16 Sep 1998 00:00
help with output of name, salary, and age.
Author: Chris Vaughn-Uding
Date: Wed, 16 Sep 1998 00:00
Date: Wed, 16 Sep 1998 00:00
8 lines
847 bytes
847 bytes
Well, I can read in the lists, sort them independently, and print them out, but I can't match the age list with the salary list. I don't know how to match the age list up with the salary list without making a third SLL. Is a third SLL ok? If not, how can I output the right info. Should this be done in the sort function? Print function? another function? Chris
Re: help with output of name, salary, and age.
Author: Dave Bingham
Date: Thu, 17 Sep 1998 00:00
Date: Thu, 17 Sep 1998 00:00
18 lines
1285 bytes
1285 bytes
Chris, I am at the same point you are. I tried to get help from Sanjay during his office hours, but he wasn't there. If you get any ideas please post. Chris Vaughn-Uding <cvaughn@holly.colostate.edu> wrote in article <6trao8$2afo@yuma.ACNS.ColoState.EDU>... > Well, I can read in the lists, sort them independently, and print them out, > but I can't match the age list with the salary list. > I don't know how to match the age list up with the salary list without > making a third SLL. Is a third SLL ok? > If not, how can I output the right info. Should this be done in the sort > function? Print function? another function? > > Chris > > >
Re: help with output of name, salary, and age.
Author: Adam Carheden
Date: Thu, 17 Sep 1998 00:00
Date: Thu, 17 Sep 1998 00:00
18 lines
1291 bytes
1291 bytes
I figured this out about about midnight last night after much frustration. First, NO, it's not okay to have a third list. I have two print functions, one for the unsorted lists and another for the sorted lists. The unsorted prints has 4 columns, printing the lists separately as Name, Age, Name Salary. Chuck said this was okay. The sorted print tests to see if the names are the same (strcmp()) before printing. If it is, it prints all fields, if it's not, it prints only the name greater in the alphabet and it's corresponding age/salary field. It then increments only the pointer of the node that it printed. Hope this helps. -- Adam carheden@holly.colostate.edu http://holly.ColoState.edu/~carheden
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads