title: C++ convert ASCII to morse code
body: <p>I have been making a program that converts Letters, Numbers and Punctuations into morse code. </p>
  
  <p>With the letters and numbers its working as I want it. </p>
  
  <p>But with the punctuations I cant make it work properly. I was hoping someone could take a look at my code and help me. </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstring&gt;
  #include &lt;sstream&gt;
  using namespace std;
  
  
  
      char ch;
      string morseWord = "";
  
      for(unsigned int i=0; i &lt; word.length(); i++)
      {
          if(isalpha(word[i]))
          {
              ch ;
          }
      }
      return morseWord;
  }
  
  
      char ch;
      string morseWord = "";
  
      for(unsigned int i=0; i &lt; word.length(); i++)
      {
          if(isdigit(word[i]))
          {
              ch = word[i];
              ch = toupper(ch);
              morseWord += morseCode[ch - '0'];
              morseWord += " ";
  
      string morseWord = "";
  
      for(unsigned int i=0; i &lt; word.length(); i++)
      {
          if(ispunct(word[i]))
          {
              ch = word[i];
              ch = toupper(ch);
              morseWord += morseCode[ch - '.'];
              morseWord += " ";
          }
      }
      return morseWord;
  }
  
  
  
  int main()
  {   
      stringstream ss;
      string sentence;
      string word = "";
  
      code: " &lt;&lt; endl;
  
      while(ss &gt;&gt; ToMorse(word) &lt;&lt; endl;
          cout &lt;&lt; PunctuationToMorse(word) &lt;&lt; endl;
  }
  </code></pre>