fork download
#include <iostream>
#include <string>

bool f(std::string const &s, bool v)
{
	std::cout << s << v << ' ';
	return v;
}

int main()
{
	std::cout << "a || b && c" << std::endl;
	for(unsigned i = 0; i < 8; ++i)
	{
		if(f("a", i&0b100) || f("b", i&0b10) && f("c", i&0b1))
		{
			std::cout << "true" << std::endl;
		}
		else
		{
			std::cout << "false" << std::endl;
		}
	}
	std::cout << "a && b || c" << std::endl;
	for(unsigned i = 0; i < 8; ++i)
	{
		if(f("a", i&0b100) && f("b", i&0b10) || f("c", i&0b1))
		{
			std::cout << " true" << std::endl;
		}
		else
		{
			std::cout << " false" << std::endl;
		}
	}
}
Success #stdin #stdout 0s 3232KB
stdin
Standard input is empty
stdout
a || b && c
a0 b0 false
a0 b0 false
a0 b1 c0 false
a0 b1 c1 true
a1 true
a1 true
a1 true
a1 true
a && b || c
a0 c0  false
a0 c1  true
a0 c0  false
a0 c1  true
a1 b0 c0  false
a1 b0 c1  true
a1 b1  true
a1 b1  true