Thread: Library Management Coding

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

    Lightbulb Library Management Coding

    This program is designed for library management, its almost can do all works. i appreciate if any suggestion for its modification is mailed to me.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Why are you spending ten seconds saying "Loading", when you are actually not loading anything?

    In add book, why not use "do ... while()" instead of a "while" loop - that way you don't have to rely on setting "ch" to "y".

    If you are actually thinking this should be useful for a real library (even a small home-library), you may want to come up with a better data-structure "on disk", since currently you have to search for (n/2), when (log(n)) should be achievable quite easily (possibly with some expense at inserting books, but if this is REALLY being used, inserting new books should be a relatively infrequent occurrence).

    You don't take into account the actual number of days in a month, so someone borrowing a book on the 25th of January will have the book for 7 days, but someone borrowing the book on 25th of February will have the book for 4 days, as it's still due to be returned on the 2nd of the next month. Also, what happens if you borrow a book on the 23rd of Febrary - even a leap-year doesn't give you a "30th of february" to return the book. Also consider new-year loans. I would suggest creating a class for "datm", as that would help you deal with dates in various ways. Internal representation in the class could perhaps be "daynumber" based on some set date back in time (1-Jan-2000?). [I wrote a bunch of date-manipulating code in my days, and I know that this will come in very useful in many ways!]

    Your code also doesn't check if the book is currently out when taking it out. (perhaps the librarian typed in the wrong book number, or it was not correctly "returned" when it came back in).

    I'm sure there are other things that could be done, but this will probably keep you busy for a few days.

    --
    Mats

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Use Boost.Date_Time for all your date manipulation needs.
    http://www.boost.org/
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. link with C runtime library
    By George2 in forum C++ Programming
    Replies: 26
    Last Post: 02-05-2008, 01:56 AM
  2. Global variable in shared library
    By krock923 in forum C Programming
    Replies: 5
    Last Post: 01-11-2008, 04:56 PM
  3. how to know which function belongs to which library?
    By gibsosmat in forum Linux Programming
    Replies: 8
    Last Post: 11-18-2007, 07:46 AM
  4. _beginthread & c run-time library
    By Hermitsky in forum C++ Programming
    Replies: 6
    Last Post: 12-15-2004, 05:57 AM
  5. Replies: 4
    Last Post: 11-12-2002, 06:26 AM