The purpose of this program is to translate a user inputed sentence into morseCode. It seems like everything is right to me, but I'm simply not getting output! What am I doing wrong, or what should I add/change? Any help is greatly appreciated.
Since you are comparing the ith character in the input string to the ith character in the alphabet array, it seems like you would only get matches (and output) when the input string resembles the alphabet string. What do you get with an input of ABCXXFG?
Morse contains the morse code read in from the text file. I understand what your saying with that particular line of code, how do you suppose I go about changing it? Thanks for replying.
You code use another loop to scan through the alphabet array looking for a match. If a match is found, you would know the offset where it was found in the alphabet array, and could use that to look-up the corresponding value in the code array.
Update: As Ulf suggested, a Map would be even better if that is an option for you.
Your updated translation method looks like it should work, but obviously you will need to be able to get the array of codes loaded-up properly to have your application to perform as expected.