soundex and char arrays

This program is a simple soundex generator. The idea is that it will prompt you for a word and the program will display the soundex code for that word. Your soundex code MUST be in a function, and it MUST follow the specification provided, this will help to allow you to reuse the code later.

Your main program will ask the user to input ten(10) words, for each word you will display the word and its soundex code.

the function spec

Your soundex function needs to meet the requirements listed. This function must not damage the input word ( hence the constant ). The returned char array must be null terminated.

the algorithm

Soundex codes for this assingment are 1 letter and 4 digits ( plus the terminating NULL ). But you will want to store the digits as characters so the entire code is the same type. The code contains the first letter of the word (case doesn't matter). and the the others are mapped to numbers. The mappings are provided below, in the table. Any time a code is the same as the code of the previous character, it is discarded. The default is "Z0000".
Letters Numbers
b,p,f,v 1
c,s,k,g,j,q,x,z 2
d,t 3
l 4
m,n 5
r 6
All Others 0

Examples

A friend of mine has the last name is Sullivan, so the 4 digit soundex is:
Sullivan
20440105
S4150

Your soundex codes for this need to be 1 letter and 4 numbers. It will be easier if you store everything as char values.

Examples:

TOMORROW T5600
tenure   T5600
damn     D5000
spell    S1400
Euler    E4600
Gauss    G2000  
Hilbert  H4163
Knuth    K5300  
Lloyd    L3000  
Lukasiewicz L2220
spellllllll s1400
lalalalalalalalalalalalalalala L4444
1234     Z0000
Here is a sample run from mine

This program is due July 8th.

Goals