Home > Back-end >  For post
For post

Time:11-05

Help bosses the bunch of c + + code
Its logic sequence is what kind of
The x3=8;
Y3=5 & amp; & ! (6/5) | | (x3=0);
The output x3=0

CodePudding user response:

The output should be y3=0, and (x3=0) should be (x3==0), first calculate the brackets, for 5 & amp; & 0 | | 0, so the result is 0

CodePudding user response:

5 is true, 6/5 is really
So, 5 & amp; & ! (6/5) is false, at that time, the last expression determines the result of y3, hence the x3=0, and because of (x3=0) is false, so y3=0
If there is no exclamation point! Because 5 & amp; & (6/5) had been true, most of the compiler no longer behind to calculate the value of the expression, so the x3=0 don't perform, but still the x3 is equal to 8, y3=1

CodePudding user response:

After the execution
The x3=0
Y3=0

CodePudding user response:

reference 1st floor qq_45779045 response:
output should be y3=0, and (x3=0) should be (x3==0), first calculate the brackets, for 5 & amp; & 0 | | 0, so the result is 0

In parentheses is x=3 assignment operations, this is our exam questions, didn't understand

CodePudding user response:

refer to the second floor SuperDay response:
5 is true, 6/5 is really
So, 5 & amp; & ! (6/5) is false, at that time, the last expression determines the result of y3, hence the x3=0, and because of (x3=0) is false, so y3=0
If there is no exclamation point! Because 5 & amp; & (6/5) had been true, most of the compiler no longer behind to calculate the value of the expression, so the x3=0 don't perform, but still the x3 is equal to 8, y3=1

Why X=0 copy expression is false

CodePudding user response:

refer to the second floor SuperDay response:
5 is true, 6/5 is really
So, 5 & amp; & ! (6/5) is false, at that time, the last expression determines the result of y3, hence the x3=0, and because of (x3=0) is false, so y3=0
If there is no exclamation point! Because 5 & amp; & (6/5) had been true, most of the compiler no longer behind to calculate the value of the expression, so the x3=0 don't perform, but still the x3 is equal to 8, y3=1

Wrong, assignment expression

CodePudding user response:

X3=0, so the x3==0 this expression is true, the x3=0 is an assignment expression, its value is equal to the value of the x3 finally because the x3=0, so the final expression is false
  • Related