| | |
Floating Point Exception Using Hash Tables
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 25
Reputation:
Solved Threads: 0
I'm writing a spellchecking program using a hash table. The hash table (a char * array) serves as the dictionary, storing words inputted from the file wordlist.txt. When I call the lookup function, a floating point exception occurs. Any suggestions you have on how to find what's causing the exception would be greatly appreciated.
Descriptions of the attached files:
1. spellcheck.cpp contains the main function, calling the Dictionary class member function "add" on every word in the file wordlist.txt.
2. hashTable.cpp contains definitions for functions in the Dictionary class. The "add" and "getIndex" functions are the only ones that are functional right now.
3. hashTable.h contains declarations.
4. wordlist.txt contains all the words that need to go in the dictionary.
5. input.txt is the input to the program, but isn't actually being used for anything yet.
Descriptions of the attached files:
1. spellcheck.cpp contains the main function, calling the Dictionary class member function "add" on every word in the file wordlist.txt.
2. hashTable.cpp contains definitions for functions in the Dictionary class. The "add" and "getIndex" functions are the only ones that are functional right now.
3. hashTable.h contains declarations.
4. wordlist.txt contains all the words that need to go in the dictionary.
5. input.txt is the input to the program, but isn't actually being used for anything yet.
> Any suggestions you have on how to find what's causing the exception would be greatly appreciated.
Use a debugger.
It will catch the exception, and then show you the line of code that TRIGGERED the exception.
From there, you look back through the code to mentally construct how it got to that point until you find where the root CAUSE of the problem happened (this is the bug).
Fix the bug, and re-test.
Use a debugger.
It will catch the exception, and then show you the line of code that TRIGGERED the exception.
From there, you look back through the code to mentally construct how it got to that point until you find where the root CAUSE of the problem happened (this is the bug).
Fix the bug, and re-test.
![]() |
Similar Threads
- Segmentation Fault becomes floting point exception -- not tied to any specific line (C)
- floating point expression (C++)
- how to read a binary file holding floating-point values (VB.NET)
- what is "floating point exception" in C++ (C++)
- Help with an Exception please? (Perl)
- Tutorial on hash tables (C)
- Floating point exception?? (C++)
- floating point (C++)
Other Threads in the C++ Forum
- Previous Thread: keep alive http socket.
- Next Thread: opening file and adding contents to array
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






