How is it possible to solve this problem

This is a discussion on How is it possible to solve this problem within the C Programming forums, part of the General Programming Boards category; For this lab exam you will try to store and sort the records of workers of a company. These records ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    1

    How is it possible to solve this problem

    For this lab exam you will try to store and sort the records of workers of a company. These records are composed by subfields (separated from each other by one white space) containing information about the worker. Because of missing or additional informations each workers record can have different number of subfields. Each subfield of a record will be composed of numbers and letters and it can have different length. Each persons records first subfield will be the workers unique ID. This ID will be composed of numbers and letters like other subfields. According to these informations an example record can be like these ones:

    62gDF345 AnDeRs Friden vocalist 3334455
    Eh43 JeSPer guitarist swedish

    Your program will get a bunch of records each one separated by a new line character. After storing these records, you will sort the records ascending (increasing order) according to their IDs (first subfield). The ordering will be case insensitive (B is same as b) and the letters are considered bigger than the numbers.

    The list of records will end with an extra new line character and there will be one query to control your algorithm. The query will be composed of three integers. The first one is the records number in the ordered list, the second one is the wanted subfields number, and the third one is the wanted characters number of this subfield. For example if the integers are x,y,z after sorting the records, you will print the x th records, y th subfields, z th character.

    Some of the important points are:
    --------------------------------
    -Sorting will be case insensitive (b=B) and letters are considered bigger than numbers.
    -The first record is considered 0 th record
    -ID of each person is considered 0 th subfield of his record
    -The first character of each subfield is considered the 0th subfield
    -Each record can have different number of subfields
    -Each subfield can have different length
    -Each subfield can be composed of numbers or letters
    -Subfields are separated by a single white space
    -Records are separated by a new line character
    -End of records is made by an extra new line character and it is followed by three integers


    -I have found out how to store the data,but i couldnt sort it.

  2. #2
    Registered User
    Join Date
    Apr 2007
    Posts
    4
    How did you manage to sort them? I have opened the same thread yesterday, if I'm not wrong you can try to sort them with strcmp function(if you've taken the inputs string by string), otherwise you have to compare char by char.

  3. #3
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Seems to me like your listing your homework... that wouldn't be breaking the rules regarding homework would it?

  4. #4
    Registered User
    Join Date
    Apr 2007
    Posts
    4
    No, it's not a homework. It's just a question that we have to solve and we can get help from anywhere we want. Believe me, our homeworks are much complicated =) But if you think opening a thread like this breaks the rules, I'm sure ahmet858585 will do the necessary things.

  5. #5
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    He isn't asking for specific help, he's bluntly asking for the worked solution NOT help for something C related.

  6. #6
    Registered User
    Join Date
    Apr 2007
    Posts
    4
    I think you're right. Sorry for inconvenience

  7. #7
    C 1337 Meshal's Avatar
    Join Date
    Nov 2006
    Posts
    70
    99% percent
    ahmet858585 == Meursault

  8. #8
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    This type of program was posted by someone else, namely Meursault.

    Array pointers

    Ask specific questions, and you'll receive specific help.

    I don't mind helping people with their homework if they are the ones doing the work. Otherwise, if you're just going to ask for the solutions, see my signature.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Solve This Problem Within 3 Hr Urgent Need
    By annum in forum C Programming
    Replies: 12
    Last Post: 10-04-2009, 10:56 AM
  2. problem solve
    By coolnarugodas in forum C Programming
    Replies: 7
    Last Post: 04-26-2005, 01:31 PM
  3. Replies: 2
    Last Post: 04-25-2005, 12:59 PM
  4. Bubble Sort / selection problem
    By Drew in forum C++ Programming
    Replies: 7
    Last Post: 08-26-2003, 04:23 PM
  5. problem cant solve please help.
    By sarah in forum C Programming
    Replies: 6
    Last Post: 09-03-2001, 02:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21