title: English to Morse code program
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  #include &lt;conio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main()
  {
      string text[39] = {"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",",","?"};
      string code[39] = {".-","-...","-.-.","-..",".","..-","--.","....","..",".---","-.-",".-..","--",
                         "-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--..",
                         ".----","..---","...--","....-",".....","-....","--....","---..","----.","-----",".-.-.-","--..--","..--.."};
      string English, Morse, output_string;
      int option, string_size = 0, location;
      char again = 'y', letter;
  
      while(again == 'y')
      {
          system("cls");
          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";
          cout &lt;&lt; "Enter 1,2,3 or 4:";
          cin &gt;&gt; option;
          cin.ignore(256,'\n');
          system("cls");
  
          switch(option)
          {
              case 1:
                  cout &lt;&lt; "\nEnter a string with multiple words to encode:";
                  getline(cin, English);
                  system("cls");
  
                  cout &lt;&lt; "\nThe target string to be translated is:" &lt;&lt; "\n";
                  cout &lt;&lt; English &lt;&lt; "\n";
  
                  string_size = English.length();
                  for(int n = 0; n &lt;= string_size-1; n++)
                  {
                      letter = (char)English.at(n);
                      if(letter != ' ')
                      {
                          for(int t = 0; t &lt;=39; t++)
                          {
                              if(letter == text[t])
                              {
                                  cout &lt;&lt; code[t] &lt;&lt; " ";
                                  break;
                              }
                          }
                      }
                      else if(letter == ' ')
                      {
                          cout &lt;&lt; "\n";
  
                      }
                  }
                  getch();
                  break;    
          }
      }
  }  
  </code></pre>
  
  <p>I didn't finish it yet, but I don't know why I can't run <code>if(letter == text[t])</code>, it says it's an error. how can I fix it? And I have no idea to write the code that Morse to English. how can I know the position of the array that the user entered?</p>
  
  <p>Error message:</p>
  
  <blockquote>
    <p>error: no match for 'operator==' (operand types are 'char' and 'std::string {aka std::basic_string}')|</p>
  </blockquote>