repeat a code automatically
<p>I wrote a code to convert any string to Morse code. The code works perfect until I try repeating it automatically.</p>

<p>Whether I use "while" or "do while" the code runs only once and then it terminates.
Would you help to find out what the problem is?  </p>

<pre><code>int main ()
{
    cout&lt;&lt;"Enter the string: ";
    char myStr[81];
    char ch='y';

    while (ch=='Y'||ch=='y')
    {
        getString(myStr);
        toUpper(myStr,strlen(myStr));
        removeSpace(myStr);
        getMorse(myStr,strlen(myStr));
        cout&lt;&lt;"to repeat press Y/y";
        cin&gt;&gt;ch;
    }
    return 0;
}
</code></pre>

<p>I added the getString() function</p>

<pre><code>void getString(char myStr[])
{
  cin.getline(myStr,81,'\n');
}
</code></pre>
