Thread: Hotel system

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    20

    Hotel system

    I am trying to create a hotel booking system.

    Should I use a 2d matrix for rooms
    and another matrix for the dates?

    A cross reference, or is there a better way

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    242
    this seems to me essentially to be a database question.

    I'm not really seeing a 2d matrix for rooms, which are just a list of room numbers, right? i'd make that field text, however, to allow for the possibility of 102A or something like that.

    then the booking would be a 2d matrix with columns of room number (multiple entries possible), arrival date, departure date, occupant name, number of occupants, daily rate, etc. not sure whether it has any advantage at all to create a unique key column here over and above your array index. if it were a database table, i definitely would, but i'm not seeing why you would need it when it's just an array.

    otherwise i'm really just building it here using c++ arrays exactly like tables in a database

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    If the room numbers are all contiguous (eg, 101 - 599) you could use a vector of strings with the dates (just subtract 101 to get the vector[element]). If not, try a STL map of strings. Maybe you want to use some kind of int for the date, it *might* make sorting easier.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Operating System
    By Houssen in forum C Programming
    Replies: 18
    Last Post: 04-22-2008, 12:51 PM
  2. File System Implementation
    By dodgeviper in forum C Programming
    Replies: 9
    Last Post: 11-16-2007, 01:04 PM
  3. Using system icons
    By @nthony in forum Windows Programming
    Replies: 1
    Last Post: 01-13-2007, 07:56 PM
  4. Linux database system needed
    By BobS0327 in forum Tech Board
    Replies: 7
    Last Post: 06-11-2006, 03:56 PM
  5. BIOS system and memory allocation problem
    By beely in forum Tech Board
    Replies: 9
    Last Post: 11-25-2003, 07:12 AM