You are on page 1of 2

Computer Science I

Programming Assignment 6
HashDCypher
Assigned: 11/21/2014
Due: 12/01/2014 via Webcourses at 11:30 pm
Problem:
In this program you will read in a hash table and a set of keys. You will then use the
provided hash function on the set of keys to generate a message hidden in the hash
table.
Requirements:
Your program should include the following 3 functions described below. These
should be implemented as the following functions:
1. populateHash: This function takes a file pointer and returns a hashTable.
In this function your program should read an input file consisting of strings
one per line (strings are no longer than 12 in length) and store them in a
hash table implemented as an array. The strings should be stored in the
order that they appear in the file. Your hash table should have this structure:
typedef struct hrow{
char value[];
}hashRow;
typedef struct hT{
hashRow rows[];
}hashTable;
2. hash: This function takes a single integer x and returns an index in the hash
table where the value matching the key x should be located. Your function
should compute 1 plus the remainder obtained when x is divided by 13.
3. getMessage: This is a void function which takes a hashTable and a file
pointer, reads keys from the file, finds the matching values in the hash table
and prints out the values in order, to reveal the hidden message which is
printed to the screen.
What do you submit?
For this assignment you are required to submit your source code as a single .c file
called hashDcypher.c. All submissions are to be made via Webcourses by the
deadline. Email Assignments will not be accepted. There will be NO EXTENSION
FOR THIS ASSIGNMENT. Also, since this is the end of the semester there will
be no 24 hours late submission.

Grading Rubric
Comments and formatting of code5
Required functions..30
Appropriate naming of variables ... 5
Correct file I/O......10
Total 2(50) = 100
Note: If your program does not compile on Eustis you will receive a maximum score
of 40 if your code has all of the functions. If your code does not compile and there
are missing functions, then you will receive a grade lower than 40.
Expectations for code testing:
Format of Input file:
The first line is an integer indicating the number of strings that will follow each on a
separate line. The strings will then be followed by a set of keys each on a separate
line. The end of the data is indicated by the number 0.
Your code will be tested on Eustis. The test file used by the TA will not be the one
given in the sample input. However, it will match the specifications given in the
assignment. For example there may be more or less lines of input but the file
format will be the same and the data will end with a 0.
Sample input.txt
10
Secret
Hope
Children
fun
this
My
Happy
get
Day
you
130
8
32
42
0
Sample output file from running code
Hope you get this
2

You might also like