TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Implementation of [Morse Code] (https://en.wikipedia.org/wiki/Morse_code). More...
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
Go to the source code of this file.
Namespaces | |
namespace | ciphers |
Algorithms for encryption and decryption. | |
namespace | morse |
Functions for [Morse Code] (https://en.wikipedia.org/wiki/Morse_code). | |
Functions | |
std::string | ciphers::morse::char_to_morse (const char &c) |
char | ciphers::morse::morse_to_char (const std::string &s) |
std::string | ciphers::morse::encrypt (const std::string &text) |
std::string | ciphers::morse::decrypt (const std::string &text) |
static void | test () |
Function to test above algorithm. | |
int | main () |
Main function. | |
Implementation of [Morse Code] (https://en.wikipedia.org/wiki/Morse_code).
Morse code is a method used in telecommunication to encode text characters as standardized sequences of two different signal durations, called dots and dashes or dits and dahs. Morse code is named after Samuel Morse, an inventor of the telegraph.
Definition in file morse_code.cpp.
std::string ciphers::morse::char_to_morse | ( | const char & | c | ) |
Get the morse representation for given character.
c | Character |
Definition at line 33 of file morse_code.cpp.
std::string ciphers::morse::decrypt | ( | const std::string & | text | ) |
Decrypt given morse coded text.
text | text to be decrypted |
Definition at line 216 of file morse_code.cpp.
std::string ciphers::morse::encrypt | ( | const std::string & | text | ) |
Encrypt given text using morse code.
text | text to be encrypted |
Definition at line 202 of file morse_code.cpp.
int main | ( | void | ) |
Main function.
Definition at line 268 of file morse_code.cpp.
char ciphers::morse::morse_to_char | ( | const std::string & | s | ) |
Get character from the morse representation.
s | Morse representation |
Definition at line 118 of file morse_code.cpp.
|
static |
Function to test above algorithm.
Definition at line 245 of file morse_code.cpp.