This program is a simple Morse code translator that can translate English text to Morse code and vice versa.
-
GCC (GNU Compiler Collection)
-
- Download the GCC compiler from the official website (https://sourceforge.net/projects/mingw-w64/).
- Choose the appropriate version of GCC based on your operating system (32-bit or 64-bit) and download the installer.
- Run the installer and follow the instructions to complete the installation process.
- Once the installation is complete, you should have GCC installed on your Windows machine.
-
-
Open your Linux terminal and type the following command to update the package list:
sudo apt-get update
-
Next, type the following command to install GCC:
sudo apt-get install build-essential
-
Once the installation is complete, you can verify that GCC is installed by typing the following command:
gcc --version
This will display the version of GCC installed on your Linux machine.
-
-
- Clone this repository
- Go to project directory
cd morse-code-translator
- Compile with
gcc src/main.c -o bin/morse-code-translator
, it will create an executable file namedmorse-code-translator
on/bin
directory - Run the program
./bin/morse-code-translator
To use the program, simply follow these steps:
- Run the program.
- Choose the option to translate either from English to Morse code or from Morse code to English.
- Enter the text to be translated.
- The program will display the translated text.
Translates English text to Morse code. Translates Morse code to English text.
The program uses a struct to store the English letters and their corresponding Morse code. When translating English text to Morse code, the program loops through each character in the text and searches for the corresponding Morse code in the struct. The program then concatenates the Morse code for each character to create the translated text.
When translating Morse code to English text, the program uses the strtok function to separate each Morse code character. The program then searches for the corresponding English letter in the struct and concatenates it to create the translated text.
Morse Code Translator
1. English to Morse Code
2. Morse Code to English
Select an option: 1
Enter English text: Hello World
Morse Code: .... . .-.. .-.. --- / .-- --- .-. .-.. -..
Morse Code Translator
1. English to Morse Code
2. Morse Code to English
Select an option: 2
Enter Morse code: .... . .-.. .-.. --- / .-- --- .-. .-.. -..
English Text: HELLO WORLD
This program was created by Adam Canray at ToolQuarry.
This project is licensed under the MIT License - see the LICENSE file for details.