title: C++ Morse to english
body: <p>So I have an assignment where I have to create a program that translates English text into morse code, and morse code to english text. So far I have done the English text to morse code and I am currently stuck on morse code to english text. I tried doing the same thing as the English to morse but I learned the hard way that it doesn't help, and I dont know where to start. I have been stuck like this for a long time, any advice on how to do this would be greatly appreciated please. So far I have this.   </p>
  
  <pre><code>string Morse [arraysize] = {".-", "-...", "-.-.", "-..",".", "..-.", "--.", "....", "..", ".---",
                     "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-",
                     "..-", "...-", ".--", "-..-", "-.--", "--..", ".----", "..---", "...--",
                     "....-", ".....", "-....", "--...", "---..", "----.", "-----", ".-.-.-",
                     "--..--", "..--.."};
  string Letter [arraysize] = {"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", "1", "2", "3", "4",
                      "5", "6", "7", "8", "9", "0", "Stop", ",", "?"};
  
  cout &lt;&lt; "1 - Encode(Text to Morse)\n";
  cout &lt;&lt; "2 - Decode(Morse Code to Text)\n";
  cout &lt;&lt; "3 - Display the Morse Code\n";
  cout &lt;&lt; "4 - Quit\n\n";
  cout &lt;&lt; "Enter 1, 2, 3 or 4: ";
  cin &gt;&gt; choice;
  
  
  case 2:
      cin.ignore();
      cout &lt;&lt; "Enter a Coded Morse Message (e.g. .- -... -.-.)";
      cout &lt;&lt; "\nSeparate Morse Code by blanks:\n";
      getline(cin,english);
      english2 = english;
      system("CLS");
      cout &lt;&lt; "You entered:\n";
      cout &lt;&lt; english;
      length1 = english.length();
      cout &lt;&lt; "\n\nThe decoded message is:\n";
      for(int n = 0; n &lt; length1+1; n++)
      {
           letter = english.at(n);
           if(letter != ' ')
           {
               for(int y = 0; y &lt; 39; y++)
               {
                   string temp;
                   temp = toupper(letter);
                   if(temp == Morse[y])
                   {
                       cout &lt;&lt; Letter[y];
                       break;
                   }
               }
           }
      }
      cout &lt;&lt; ".-.-.-\n";
      system("pause");
      english.erase();
      break;
  </code></pre>