How to prevent the user from entering more than one character in the below sample code?
<p>I am facing problem in the below code. If the user enter more than one charater then my loop gets executed number of times equal to the length of the string entered by the user. My code is written in GNU c/c++ compiler.</p>

<p>Thanks in advance.</p>

<pre><code>int continue_option()
{
    char c;
        loop:
        fflush(stdin);
                cin.ignore();
        cout&lt;&lt;"\n\n\t\t\t\tPress (Y/y) - Continue / Press (N/n) - Exit :";
                cin&gt;&gt;c;
        if(c=='y'||c=='Y')
        {
                          system("clear");
                   }
        else if(c=='n'|| c=='N') 
        {
            exit(0);
        }
        else
            {
                printf("\n\t\t\t\tInvalid Option.Try Again.....");
                                goto loop;
                        }
        fflush(stdin);
}
</code></pre>
