How to use nested ternary operators in C++ : <p>I am trying to use nested ternary operators using following code, but it is giving wrong answer, I am not getting what's the mistake is. </p>

<pre><code>#include &lt;iostream&gt;
using namespace std;
int main()
{
cout&lt;&lt;"Hello World\n";
int age, Result ;
cout&lt;&lt;"Enter age:";
cin&gt;&gt;age;

Result=age&lt;0?-1
        :0&lt;=age&lt;=10?0
        :11&lt;=age&lt;=18?1
        :-2;
cout&lt;&lt;"Result is: "&lt;&lt;Result;

return 0;
}
</code></pre>

<p>For the input age 13 its giving Result as 0 and for input age 20 also its giving result as 0. I am not getting what's the mistake. Could you help me? Thank you. </p>
