No.(edit, see below)
!(a && b || c && d)
is
(!(a && b) && !(c && d))
which translates to
((a || b) && (c || d))
If you don't believe me write a test program
Cheers
Edit: I didn't believe myself, so here is the test program:
#include <iostream>
void test(bool a, bool b, bool c, bool d)
{
std::cout << "a: " << std::boolalpha << a << ", "
<< "b: " << std::boolalpha << b << ", "
<< "c: " << std::boolalpha << c << ", "
<< "d: " << std::boolalpha << d << std::endl;
if (a && b || c && d)
{
std:: cout << "1. code 1" << std::endl;
}
else
{
std:: cout << "1. code 2" << std::endl;
}
if ((a || b) && (c || d))
{
std:: cout << "2. code 2" << std::endl;
}
else
{
std:: cout << "2. code 1" << std::endl;
}
if (!(a && b || c && d))
{
std:: cout << "3. code 2" << std::endl;
}
else
{
std:: cout << "3. code 1" << std::endl;
}
if ((!a || !b) && (!c || !d))
{
std:: cout << "4. code 2" << std::endl;
}
else
{
std:: cout << "4. code 1" << std::endl;
}
}
int main()
{
for (int i = 0; i < 16; ++i)
{
test(i & 8, i & 4, i & 2, i & 1);
}
return 0;
}
And here are the results:
a: false, b: false, c: false, d: false
1. code 2
2. code 1
3. code 2
4. code 2
a: false, b: false, c: false, d: true
1. code 2
2. code 1
3. code 2
4. code 2
a: false, b: false, c: true, d: false
1. code 2
2. code 1
3. code 2
4. code 2
a: false, b: false, c: true, d: true
1. code 1
2. code 1
3. code 1
4. code 1
a: false, b: true, c: false, d: false
1. code 2
2. code 1
3. code 2
4. code 2
a: false, b: true, c: false, d: true
1. code 2
2. code 2
3. code 2
4. code 2
a: false, b: true, c: true, d: false
1. code 2
2. code 2
3. code 2
4. code 2
a: false, b: true, c: true, d: true
1. code 1
2. code 2
3. code 1
4. code 1
a: true, b: false, c: false, d: false
1. code 2
2. code 1
3. code 2
4. code 2
a: true, b: false, c: false, d: true
1. code 2
2. code 2
3. code 2
4. code 2
a: true, b: false, c: true, d: false
1. code 2
2. code 2
3. code 2
4. code 2
a: true, b: false, c: true, d: true
1. code 1
2. code 2
3. code 1
4. code 1
a: true, b: true, c: false, d: false
1. code 1
2. code 1
3. code 1
4. code 1
a: true, b: true, c: false, d: true
1. code 1
2. code 2
3. code 1
4. code 1
a: true, b: true, c: true, d: false
1. code 1
2. code 2
3. code 1
4. code 1
a: true, b: true, c: true, d: true
1. code 1
2. code 2
3. code 1
4. code 1
Conclusion. You were correct!