Nested IF-Else Vs Logical Operator

Could you please me in solving the question- why nested if is bad than logical operator?

Are you asking something like this?

1
2
3
4
if( this1 == true && this2 == true ) cout << "Both are true";
else if( this1 == true && this2 == false ) cout << "This1 is true and this2 is false";
else if( this1 == false && this2 == true ) cout << "This1 is false and this2 is true";
else cout << "Both are false";


vs

1
2
3
4
5
6
7
8
9
10
if( this1 == true )
{
    if( this2 == true ) cout << "Both are true";
    else cout << "This1 is true and this2 is false";
}
else if( this1 == false )
{
    if( this2 == true ) cout << "This1 is false and this2 is true";
    else cout << "Both are false";
}


Or could you please give a more detailed question?
Topic archived. No new replies allowed.