Home > Back-end >  Why is the result, not 7, 7; 1, 1; ?????
Why is the result, not 7, 7; 1, 1; ?????

Time:10-01

#include
The main ()
{
58, 58, int x=y=-
X=x> 3;/* x moves to the right three */
Y=y> 3;/* y moves to the right three */
The printf (" result1 is: % d, % d \ n ", x, y);
X=x> 2;/* x moves to the right two */
Y=y> 2;/* x moves to the right two */
Printf (" the result2 is: % d, % d \ n ", x, y);
}

CodePudding user response:

Understand computer storage mode,
Stored inside the computer in order to complement, in 32 bits, for example
Storage of 58,
58 of the original code: 0000, 0000, 0011, 1010
58 complement and the original code, moves to the right three become, 0000, 0000, 0000, 0111, or 7.
- 58 of the original code: 1000, 0000, 0011, 1010
- complement of 58:1111, 1111, 1100, 0110
Moves to the right three: 1111, 1111, 1111, 1000
This source code is also ask him again complement, 1000, 0000, 0000, 1000, reflected is - 8.
So can't with their own ideas to make computer subject with you,

CodePudding user response:

The
refer to the original poster qq_26943967 response:
# include
The main ()
{
58, 58, int x=y=-
X=x> 3;/* x moves to the right three */
Y=y> 3;/* y moves to the right three */
The printf (" result1 is: % d, % d \ n ", x, y);
X=x> 2;/* x moves to the right two */
Y=y> 2;/* x moves to the right two */
Printf (" the result2 is: % d, % d \ n ", x, y);
}



Shift and division are not identical