Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Associative arrays and Hash Tables Need help

Status
Not open for further replies.

ksoong

Programmer
Oct 3, 2000
57
CA
I need help with a Unix C++ program. I'm working on an email filter for a course that should read the keyword from a text database as well as it's location in the email header.

I want to be able to do this using associative arrays or hash tables because when I run sequentially through an array of strings comparing to see whether the keyword exists in the strings, it takes forever.

Also I'd like some way of storing the keyword and also it's location. But i'd like to be able to do it using only one table or array or whatever, instead of one table holding the keyword and one table for the corresponding email location. I did this before using Associative arrays in Perl but I don't know if C++ has something like that.


Does STL have something like that? or is hash tables it? If hash tables is it, can someone tell me how to use a hash table cuz I can't find anything on the net, except some scattered documents.

thanks in advance...

Kenneth
 
Kenneth,

Look at the stl map template and also from the sound of your project you might need stl string template as well.

Good luck
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top