Hash functions

I am totally new to this site as i am also a beginner in c++. I need help in coding this please.

Write a C++ program that asks the user to enter as many words as he/she wishes. Every time that a
new word is entered, it will be stored in a file called infile. Once the user stops entering new words,
the program will apply 3 hash functions to each of the words. To this end, the program will read the
words stored in the file infile one by one and apply for each of them the 3 hash functions
mentioned below. The size of the hash table for each function will be the double of the number of
words entered by the user. The hash tables resulting from the application of the 3 hash functions will
then be inserted in a new file called outfile. The program will also insert in this file the number of
collisions resulting from the application of each hash function.
Hash function 1:
hash(key) = (number of characters of key * 5)
2 mod sizeHashTable
Hash function 2:
hash(key) = (sum of ASCII codes of every character in key) mod
sizeHashTable
Hash function 3:
hash(key) = (sum of ASCII codes of the characters next to every
character in key - number of characters of key) mod sizeHashTable
For this 3rd
hash function, it means that if the key is aTzM then we sum the ASCII codes of bUaN.
Please note, that this is not a homework site. We won't do your homework for you. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.

We didn't see your attemts to solve this problem youself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again. As it is impossible to find deriviative of function without knowledge in ariphmetics, you cannot do more complex tasks in programming without clear understanding of basics
Topic archived. No new replies allowed.