Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Character {
- char english;
- string morse;
- public:
- Character(char english, string morse) {
- this->english = english;
- this->morse = morse;
- }
- string getCode() {
- return this->morse;
- }
- char getEnglish() {
- return this->english;
- }
- };
- int main()
- {
- Character* characters[26] = {
- new Character('a',".-"),
- new Character('b',"-.-."),
- new Character('c',"-.."),
- new Character('d',"-..."),
- new Character('e',"."),
- new Character('f',"..-."),
- new Character('g',"--."),
- new Character('h',"...."),
- new Character('i',".."),
- new Character('j',".---"),
- new Character('k',".-."),
- new Character('l',".-.."),
- new Character('m',"--"),
- new Character('n',"-."),
- new Character('o',"---"),
- new Character('p',"-..-"),
- new Character('q',"--.-"),
- new Character('r',".-."),
- new Character('s',"..."),
- new Character('t',"-"),
- new Character('u',"..-"),
- new Character('v',"...-"),
- new Character('w',".--"),
- new Character('x',"-..-"),
- new Character('y',"-.--"),
- new Character('z',"--.."),
- };
- string code = "...././.-../.-../---\n";
- string substring = code.substr(0, hasChar(code, ' ')) + '\n';
- for (int i = 0; i < characters.lenght; i++) {
- delete characters[i];
- }
- delete characters;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement