Help me with this Hash Table assignment..PLESE I beg you guys.

This is a discussion on Help me with this Hash Table assignment..PLESE I beg you guys. within the C++ Programming forums, part of the General Programming Boards category; hello everyone... can you help me with this assignment about hash tables.. I run the code on a linux machine ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    1

    Help me with this Hash Table assignment..PLESE I beg you guys.

    hello everyone...

    can you help me with this assignment about hash tables..
    I run the code on a linux machine and gave me errors..

    the assignment in attachment

    and here is my code:

    http://www.mediafire.com/file/hophmdnnyze/Asem.zip

    can anyone fix this please...I need to hand it today..

    thank you all
    Asem
    Attached Files Attached Files

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,256
    Please refer to the homework policy.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,655
    What errors did it give you?

    ETA: After fixing a few warnings related to the comparison of unsigned/signed and reusing counter variables in your for(;;) constructs, it compiled, ran and seemed to at least work without crashing. This is not to say that it necessarily generates the results you expect, but hopefully this is a stepping-off point for you.

    To fix the counter variable problem, change this:
    Code:
    string swapLetters(string NodeData,int lettertoswap)
    {
        string output="";
        int len=NodeData.length();
    	for(int i=0;i<lettertoswap;i++)
             output=output+NodeData[i];
        output=output+NodeData[i+1];
        output=output+NodeData[i];
    	for( i=lettertoswap+2;i<len;i++)
             output=output+NodeData[i];
        return output;
    }
    to this:
    Code:
    string swapLetters(string NodeData,int lettertoswap)
    {
        string output="";
        int len=NodeData.length();
        int i = 0;
        for(i=0;i<lettertoswap;i++)
            output=output+NodeData[i];
        output=output+NodeData[i+1];
        output=output+NodeData[i];
        for( i=lettertoswap+2;i<len;i++)
            output=output+NodeData[i];
        return output;
    }
    Last edited by rags_to_riches; 08-25-2008 at 01:40 PM.

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    I bet if you spent the same amount of time researching your errors instead of shotgunning forums begging people to finish your homework for you, you might actually have made the deadline. Consider this a learning experience.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Array of Linked Lists - Hash table
    By FortinsM3 in forum C Programming
    Replies: 12
    Last Post: 02-25-2009, 10:20 PM
  2. Writing array, to file
    By zootreeves in forum C Programming
    Replies: 9
    Last Post: 09-08-2007, 06:06 PM
  3. Duplicate at Hash Table
    By DarrenY in forum C Programming
    Replies: 1
    Last Post: 05-10-2007, 03:31 AM
  4. Replies: 1
    Last Post: 10-27-2006, 02:21 PM
  5. Hash Table Problem.
    By penance in forum C Programming
    Replies: 9
    Last Post: 07-24-2005, 02:03 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21