Thread: I wish to know what it mean...

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    18

    I wish to know what it mean...

    I ALSO NOT ASK FOR ENTIRE PROGRAM !
    I wish to know what is mean by the blue line and how it look like !
    ----------------------------------------------------------------------------------------------------------
    Note: You may use <string.h> library functions such as strcpy and strcmp.

    Hobbiton Town is a fictitious town populated by a race called hobbits.

    You are to develop a program to allow users to keep track on the hobbits in Hobbits Town.

    A HobbitRec contains the below information:

    - HobbitID : 10 characters
    - Name : 30 characters
    - DateOfBirth : date format in nested date structure type dd/mm/yyyy
    - Height : float type
    - Weight : float type


    You program should be able to store up to 1000 HobbitRec records in an array called HobbitsArray.

    Your program should at least perform the below operations:

    - Add new hobbit records into HobbitsArray
    - Display all hobbits' records
    - Find and display a particular hobbit given the name or HibbitID
    - Delete a particular hobbit given the name or HibbitID
    - Update a particular hobbit's record given the name or HibbitID
    ----------------------------------------------------------------------------------------------------------

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Code:
    struct hob
      {
      char hobbitid[11];
      char name[31];
      etc.....
      }
    
    hob hobbitsarray[1000];

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    18
    Oh, I see...
    Example i have to print out hobbitid, is it look like this :
    Code:
    printf("%s", hobbitsarray.hobbitid);
    Correct or not ?

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    >Correct or not ?

    Not.

    Reference a particluar element of the array.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Registered User
    Join Date
    Sep 2003
    Posts
    18
    Reference a particluar element of the array.
    Huh ?
    I don't understand what you mean...

  6. #6
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Code:
    hobbitsarray.hobbitid
    should be:
    Code:
    hobbitsarray[124].hobbitid
    so you are using the hobbitid of the 125th hobbit record (remember count from 0)

  7. #7
    Registered User
    Join Date
    Sep 2003
    Posts
    18
    Oh, I see
    I understand now !
    Thanks for you guy helping ~!

Popular pages Recent additions subscribe to a feed