1. ## Help plz, Booleans

i dont like spamming & im sure theres a post with this exact same question 100 times over but right now im 2 lazy to look, ty.

What are these comparing to?

Code:
```A. !( 1 || 0 )                ANSWER: 0
B. !( 1 || 1 && 0 )       ANSWER: 0 (AND is evaluated before OR)
C. !( ( 1 || 0 ) && 0 )  ANSWER: 1 (Parenthesis are useful)```
Im learning c++ & from what i understand you are supossed to do a comparison of some kind then compare the comprisons:

Code:
`(!(1==0) && 0+1 > 0)   ANSWER: false`
but up above it returns integers rather than a simple true or false, can someone explain this to me?

2. i'm too lazy to give you the answer

i lied. i performed the search for you. total time: less than 10 seconds. here is the answer

Newbie question !( 1 || 0 ) - ?

[/edit]

3. Originally Posted by tagman
Code:
`(!(1==0) && 0+1 > 0)   ANSWER: false`
but up above it returns integers rather than a simple true or false, can someone explain this to me?
not sure what you mean here, if you are expecting the output of the words "true" or "false" then don't hold your breath. bool is an intergral type and only outputs 0 or 1 which technically are intergers but internally they are actually type bool and you will get a warning if you try to compare/use them as integers. For example Windows redfines integer as BOOL to use as bools, but they ARE integers. C++ defines a bool which is an integral type but is not an integer thus:

Code:
```#include <iostream>
#include "windows.h"
using namespace std;

int main()
{
BOOL window_bool = TRUE; //TRUE is defined in windows as the integer 1;

bool cplusplus_bool = true; // true here is a built in constant (?) of type bool

if (window_bool == cplusplus_bool)
{
//...dosomething
}
}```
gives this warning:

warning C4805: '==' : unsafe mix of type 'BOOL' and type 'bool' in operation

changing it to: int window_bool, gives the same warning