Advertisement
cperryoh

Untitled

May 9th, 2021
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 KB | None | 0 0
  1. class Character {
  2.     char english;
  3.     string morse;
  4. public:
  5.     Character(char english, string morse) {
  6.         this->english = english;
  7.         this->morse = morse;
  8.     }
  9.     string getCode() {
  10.         return this->morse;
  11.     }
  12.     char getEnglish() {
  13.         return this->english;
  14.     }
  15. };
  16. int main()
  17. {
  18.     Character* characters[26] = {
  19.         new Character('a',".-"),
  20.         new Character('b',"-.-."),
  21.         new Character('c',"-.."),
  22.         new Character('d',"-..."),
  23.         new Character('e',"."),
  24.         new Character('f',"..-."),
  25.         new Character('g',"--."),
  26.         new Character('h',"...."),
  27.         new Character('i',".."),
  28.         new Character('j',".---"),
  29.         new Character('k',".-."),
  30.         new Character('l',".-.."),
  31.         new Character('m',"--"),
  32.         new Character('n',"-."),
  33.         new Character('o',"---"),
  34.         new Character('p',"-..-"),
  35.         new Character('q',"--.-"),
  36.         new Character('r',".-."),
  37.         new Character('s',"..."),
  38.         new Character('t',"-"),
  39.         new Character('u',"..-"),
  40.         new Character('v',"...-"),
  41.         new Character('w',".--"),
  42.         new Character('x',"-..-"),
  43.         new Character('y',"-.--"),
  44.         new Character('z',"--.."),
  45.     };
  46.     string code = "...././.-../.-../---\n";
  47.     string substring = code.substr(0, hasChar(code, ' ')) + '\n';
  48.     for (int i = 0; i < characters.lenght; i++) {
  49.         delete characters[i];
  50.     }
  51.     delete characters;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement