Skip to the content of the web site.

Project J.1: Converting to Morse code

Converting to Morse code is a simple and straight-forward conversion, something that can be done with a switch statement.

In the source file is such a simple function. Add to it the Morse code for the ten digits, as well as the following: .,?'~/()&:;=+-_"$. See Wikipedia for these.

From these, take a string of characters, and create a new string that is sufficiently long for all the necessary characters:

Between any two characters that are converted to Morse code, there should be one Space character, and between words there should be three Space characters.

Acknowledgement

Albert Ndur-Osei suggested this project.