Yes/No program using while loop in C++
<p>I'm trying to make a program that asks the user whether they would like to continue to the next calculation. For some reasons whenever I enter y or Y, the program ends. However, if I use only one condition inside the if statement(without '||'sign), the code works fine. I just want to make sure that the user can enter both upper and lower case.</p>

<p>What's wrong with the code? Is there a better way to do this?</p>

<pre><code>int main()
{
    char choice;
    while(true)
    {
        cout&lt;&lt;"Would you like to perform other calculation?(Y/N)"&lt;&lt;endl;
        cin &gt;&gt; choice;
        if(choice == 'Y'|| choice =='y'){
        return true;
        }else if(choice =='N'||choice =='n'){
        return false;
        }
    }
return 0;
}
</code></pre>