All pastes #548683 Raw Edit

Untitled

public cpp v1 · immutable
·published 2007-06-07 20:30 UTC
rendered paste body
/*Insert information*/int table::adtHashFunction(const char * cpKey, const char * cpDescription,const char * cpOtherPeople, const char * cpActivityDate) {    /*To save some coding...*/    struct node * newnode;    unsigned int adtHashPosition = 0;    newnode = new node;    /*Take each element in cpKey, add the ascii value's togeather*/    for(int i = 0; i < strlen(cpKey); i++)    {        //Add each letter of the clients key for the hash position        adtHashPosition = adtHashPosition + cpKey[i];    }    //Mod hash position by hash size to get a constrained number    adtHashPosition = adtHashPosition % hashsize;        /*Set activity and corresponeding data*/    newnode->next = adtHashTable[adtHashPosition];    newnode->key = strdup(cpKey);    newnode->activity = strdup(cpKey);    newnode->description = strdup(cpDescription);    newnode->otherpeople = strdup(cpOtherPeople);    newnode->activitydate = strdup(cpActivityDate);        adtHashTable[adtHashPosition] = newnode;}