Describing where this quadratic is negative involves describing a set of numbers that are simultaneously greater than the smaller root (+1) and less than the larger root (+3). Write a C++ Boolean expression that is true when the value of this quadratic is negative.

Respuesta :

Answer:

The Boolean Expression is (x >1)&&(x<3)  

Explanation:

As mentioned in the question that to describe where the given quadratic is negative involves describing:

  • a set of numbers that are greater than the smaller root which is +1
  • a set of numbers that are less than larger root which is +3

So when the quadratic is negative the following boolean expression is true:

                                               (x >1)&&(x<3)

This expression means that the set of numbers are greater than 1 and less than 3. x represents such number. So this boolean expression returns a boolean value true when the 1 and 2 are true. It can also be returned as 1 (which means true in boolean). In the above expression > and < are relational operators used for comparison and & is called logical operator which depicts that both (x>1) and (x<3) should hold or should be true for the expression to return true.

Example of boolean expression

The logic of Boolean expressions is explained with the following chunk of C++ code. For example x is a number, (x>1)&&(x<3) is an expression whose result is stored in "bool" data type variable result. If this expression holds true(i.e. value of x is greater than 1 and less than 3) then output will be 1 (true) otherwise 0(which means false).

int x;

cout<<"enter value";

cin>>x;

bool result;

result=(x>1)&&(x<3);  

  cout<<result;