Thread: Final Database.... :^)

  1. #1
    Senor Member nomi's Avatar
    Join Date
    Jan 2004
    Posts
    129

    Smile Final Database.... :^)

    After a lot of work and help from the people at the cprogramming.com forums, I have finally finished my first database.

    I would like to share it with you guys and would love it if you could mark me on it in the following categories:
    1. Program Efficiency- /10
    2. Documentation- /10
    3. Programming Style- /10
    4. User Interface- /10

    Please mark me out of 10 in all categories. Any extra help and advice will be much appreciated.

    Theres nothing great about my program except the fact that it is the largest one I have ever created and put so much work into.

    I am attaching a *.zip file with the following contents:
    database.cpp
    database.exe
    WMinventory.dat
    WMinventory.dat.cpy

    Thanks to everyone who has helped, specially Prelude, Salem, Waltp and ofcourse Hammer.

    EDIT: Clicked submit by mistake, sry for the double thread.

  2. #2
    Senor Member nomi's Avatar
    Join Date
    Jan 2004
    Posts
    129
    So, this is what it comes down to, "its always the foreign guy"

    :'( no replies :'(

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    195
    I think that database is really cool, cause i made one a really long time ago that was practically identical. But yes, that is awesome, keep up the good work

    Efficiency - 9 (some parts could be done easier)
    Documentation - 10
    Programming Style -?? i dunno
    User Interface - 9

  4. #4
    Senor Member nomi's Avatar
    Join Date
    Jan 2004
    Posts
    129
    YEY.....

    ....awaiting Prelude's, Hammer's, Salem's and Waltp's verdict....
    Last edited by nomi; 01-15-2004 at 10:55 PM.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,667
    All the issues I mentioned here still exist.

    Other things...
    > for(i=0;i<=arrayL-1;i++)
    The usual code for iterating over all the members of an array is
    for(i=0;i<arrayL;i++)

    > Notes: Requires <conio.h> and <stdlib.h>
    This seems excessive to me
    In addition, it is also wrong for addItems

    > scanf("%d",&num);
    > while(getchar() != '\n');
    You do this often enough to consider a function which calls
    - fgets() to read a line
    - sscanf() to convert to an integer

    > buff2[strlen(buff2)-1]='\0';
    If fgets() fills the buffer, there will be no newline, so this will instead just wipe out the last char of your input.
    char *p = strchr( buff, '\n' ); if ( p ) *p = '\0';
    only wipes out a newline if there is one to start with.

    > saveData(inventory,arrayL);
    If this were a real database, I would be calling this a lot more to store the current DB in a 'recover' file.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Looking over the beginning section, up to adding items, heed Salem's suggestion -- lose the scanf()'s

    This section:
    Code:
    printf("\n\nPlease enter number of Items you wish to enter: ");
    scanf("%d",&num);            /* get number of time to loop addItems(); */
    while(getchar() != '\n');            /* clear buffer of crap */            
    for (i=1;i<=num;i++)
    {    
        addItems(inventory,&arrayL);
    }
    If this is for a store like WalMart, do you really want some peon to count 246 items to figure out how many to add? Change this to:
    Code:
    int item;
    do
    {
        item = addItems(inventory,&arrayL);
    } while (item)
    In addItems, return TRUE if an item was entered, FALSE if not.

    That's as far as I got so far.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  7. #7
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Make the changes suggested, and I'll review version 2 of your program. No point in me commenting on this one, you appear to have enough to work on for now.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  8. #8
    Senor Member nomi's Avatar
    Join Date
    Jan 2004
    Posts
    129
    Oh man....thx for the input....i am working on the changes and will post in say a week or so....

    THX...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. literature database: help with planning
    By officedog in forum C++ Programming
    Replies: 1
    Last Post: 01-23-2009, 12:34 PM
  2. Creating a database
    By Shamino in forum Game Programming
    Replies: 19
    Last Post: 06-10-2007, 01:09 PM
  3. Replies: 10
    Last Post: 05-18-2006, 11:23 PM
  4. Developing database management software
    By jdm in forum C++ Programming
    Replies: 4
    Last Post: 06-15-2004, 04:06 PM
  5. Making a Simple Database System
    By Speedy5 in forum C++ Programming
    Replies: 1
    Last Post: 03-14-2003, 10:17 PM