In: Computer Science
What is evaluated first in a compound condition in an IF statement ?
not |
||
or |
||
and |
||
== |
1) NOT (!)
2) == (equility)
3) AND (&&)
4) OR (||)
#include <iostream>
using namespace std;
int main() {
bool b1=true;
bool b2=false;
bool b3=false;
bool b4 =false;
if(!b1==b3 && b4 || b2 ){
cout<<"true"<<endl;;
}else{
cout<<"false"<<endl;
}
bool b8=false;
bool b5=true;
bool b6=false;
bool b7 =false;
if(!b8&&b5 ==b6 || !b7 ){
cout<<"true";
}else{
cout<<"false";
}
}