String to Morse Translator | Sololearn: Learn to code for FREE!

+2

String to Morse Translator

Can I make this with an algorhthm instead of a switch? I thought of two arrays and some loops but my logic isn't that good to finish it :D https://code.sololearn.com/cnGmc5KRo43X/?ref=app

8/30/2017 8:14:13 AM

Gabriel Popa

11 Answers

New Answer

+2

mine https://code.sololearn.com/W9rH0YLcgfzd/?ref=app almost same process as https://code.sololearn.com/WM34m8Gd0TlL/?ref=app

+2

If you can find a pattern in the Morse Code that would make things a lot easier

+2

hmm maybe this site can help http://frank.vanhaste.com/morse.html But as it looks like, you might need to do some hard textual coding anyway My guess is that the Switch is thus far the best method

+1

Thank, you limitless! I found one at the numbers but it's harder with the letters, so... :) Great idea though

+1

hmm maybe this site can help http://frank.vanhaste.com/morse.html But as it looks like, you might need to do some hard textual coding anyway

+1

ysraelcon so far so good. A multi-dimensional array is great, but what if the user inserts an uppercase letter?

+1

ready, case insensitive enabled šŸ‘Œ

+1

u can use a string and an array the string contains characters, and the array contains Morse code , the index of each character in the string must correspond to the index of its Morse code in the array , the following code illustrates this for three characters : abc

+1

https://code.sololearn.com/cEkEbMhA7BDP/?ref=app

0

You can use array of strings instead of a switch, it is quicker to right/execute (not much but still) but bigger in memory (Here also not that much)

0

Anyway, your answer has been accepted, your algorythm is better and easier to write anyway :P