Question #46557

Evaluate the following c++ expression (assume x=-1,y=2)

A)x>y
B)x+y=y

Expert's answer

Answer on Question #46557, Programming, C++

Problem.

Evaluate the following c++ expression (assume x=-1, y=2)

A) x > y

B) x + y = y

Solution.

A) x > y is false, as -1 < 2.

B) We suppose that the correct statement is "x + y >= y", as "=" is assignment operator in C++, also see http://www.nios.ac.in/media/documents/TMAsr13/19D.Computer%20Science%20(330).pdf.


x + y >= y


is false, as -1 + 2 = 1 < 2.

Answer: A) false; B) false.

http://www.AssignmentExpert.com/

LATEST TUTORIALS
APPROVED BY CLIENTS