#include #include #include #include using namespace std; int main() { const int size{36}; char symbols[size]{ 'A','B','C','D','E','F','G','H','I','J','K','L','M', 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z', '0','1','2','3','4','5','6','7','8','9' }; string morse[size]{ ".-","-...","-.-.","-..",".","..-.","--.","....","..", ".---","-.-",".-..","--","-.","---",".--.","--.-",".-.", "...","-","..-","...-",".--","-..-","-.--","--..", "-----",".----","..---","...--","....-",".....","-....", "--...","---..","----." }; string text; cout << "Enter text to convert to Morse code: "; getline(cin, text); cout << "Morse code: "; for (char ch : text) { if (ch == ' ') { cout << "/ "; continue; } ch = static_cast(toupper(static_cast(ch))); for (int i{}; i < size; ++i) { if (symbols[i] == ch) { cout << morse[i] << ' '; break; } } } cout << '\n'; return EXIT_SUCCESS; }