If statement not working how I want it to
<p>The following C++ code:</p>

<pre><code>if (a != '0.5' || a != '0.6')
{
    cout &lt;&lt; "The answer is neither 0.5 nor 0.6 " &lt;&lt; '\n';
}
</code></pre>

<p>I have also tried</p>

<pre><code>if ((a != '0.5') || (a != '0.6'))
{
   cout &lt;&lt; "The answer is neither 0.5 nor 0.6 " &lt;&lt; '\n';
}
</code></pre>

<p>and tried</p>

<pre><code>if ( !(a== '0.5') || !(a==0.6)
{
     cout &lt;&lt; "The answer is neither 0.5 nor 0.6 " &lt;&lt; '\n';
}
</code></pre>

<p>Receives a number from a user and checks if the number is 0.5 or 0.6; if it is it should execute as a false statement but if it's any other number it should execute as true. However, it keeps executing as true though it should execute as false when I enter 0.5 or 0.6. This is different when I use an else if statement in which it works fine that is:</p>

<pre><code>if (a != 0.5)
{
    //what to do if true.
}
else if (a != 0.6)
{
    //What to do if this is true and the first id wrong.
}
else
{
    //What to do if none are true.
}
</code></pre>

<p>Why can't the != execute in the if statement?</p>
