Is this to simply test if it is true for single input values of x, y (for example)?

or a range of values?

A crude way of doing it is simply

// input range to scan values

cin >> lowerx;

cin >> upperx;

...

// loop over all combinations of x and y

for (int x = lowerx; x < upperx; x++)

{

for (int y = lowery; y < uppery; y++)

{

if (!(x<5)&&!(y>=7) != !((x<5)||(y>=7))) // test equivalence

{

printf("Expressions are not equivalent. x = %d, y = %d", x, y);

return;

}

}

}

printf("Expressions are equivalent over the specified range");

return;

of course there is no need to scan the range, you just have four cases to examine

to show De Morgan's law to be correct

e.g. !a && !b == !(a || b) or !a || !b == !(a && b)

when

a == TRUE, b == TRUE

a == TRUE, b == FALSE

a == FALSE, b == FALSE

a == FALSE, b == TRUE

// test a single set of values of x and y

bool a = x < 5;

bool b = y >= 7;

if (!a && !b == !(a || b))

printf("Equivalent");

else

printf("Not equivalent");

and just test the four cases with specific values of x and y (doesn't matter which values really)

e.g.

x = 4, y = 7 (TRUE, TRUE)

x = 4, y = 6 (TRUE, FALSE)

x = 5, y = 6 (FALSE, FALSE)

x = 5, y = 7 (FALSE, TRUE)

It all really depends on what the question expects from you.