Home > Back-end >  Ask, why the characters of 5 1 is highest?
Ask, why the characters of 5 1 is highest?

Time:10-02

C='5';
Int b [8];
For (int I=0; i<8; I++)
{
[I]=(b (c & gt;> I) & amp; 1);
cout}

1
0
1
0
1
1
0
0

CodePudding user response:

Character is the ASCII code of 5 0 x35, binary is 0011 0101
Because you started the output bits, you read off your application again

CodePudding user response:

reference 1/f, walk every step response:
character is the ASCII code of 5 0 x35, binary is 0011 0101
Because you started the output bits, you again carefully read off your program

Thank you for the great god, to be honest I come online to find this code, how about an operation, I didn't understand
Want to ask next:
1. Cycle at this time, when I=0, is refers to the lowest? Or the highest level?
2. & gt;> Moves to the right means, such as a byte is eight bits, bit move on bit from left to right?
3. & lt; thank you

CodePudding user response:

For (int I=0; i<8; I++)
{
[I]=(b (c & gt;> I) & amp; 1);
cout}

Write programs, will first write pseudo code

I from 0 to 7 cycle
{
B is equal to (c shift to the right I, and with 1 and operation)
Print the value of b
}

Loop unrolling,
B is equal to (0 c shift to the right, and do with 1 and operation), also is the equivalent of b is equal to the binary lowest
0101 moves to the right 0 0011, equal to not move, and with 1 and operation, equivalent to
0011, 0101,
0000, 0001 & amp;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
0000, 0001,


B is equal to (c shift to the right one, and with 1 and operation)
0011 0101 moves to the right one, and with 1 and operation, equivalent to
0011, 010,
0000, 0001 & amp;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
0000, 0000,

CodePudding user response:

The
reference 3 floor walk every step response:

Thank god, I seemed to understand the shift to the left, right, the concept of before is my wrong,
Assuming that the binary 00110101
Moves to the right one is 00011010 fill the most on the left is the highest level 0, right?
By the same token, the left and the right fill (low byte 0), I understand it right?

In addition, 5 is not should be 0000 0101 yards? Why is 0011 0101?

CodePudding user response:

reference 4 floor oracleperl response:
Quote: reference 3 floor walk every step response:


Thank god, I seemed to understand the shift to the left, right, the concept of before is my wrong,
Assuming that the binary 00110101
Moves to the right one is 00011010 fill the most on the left is the highest level 0, right?
By the same token, the left and the right fill (low byte 0), I understand it right?

In addition, 5 is not should be 0000 0101 yards? Why is 0011 0101?

5 and '5' is not the same!

CodePudding user response:

reference 4 floor oracleperl response:
Quote: reference 3 floor walk every step response:


Thank god, I seemed to understand the shift to the left, right, the concept of before is my wrong,
Assuming that the binary 00110101
Moves to the right one is 00011010 fill the most on the left is the highest level 0, right?
By the same token, the left and the right fill (low byte 0), I understand it right?

In addition, 5 is not should be 0000 0101 yards? Why is 0011 0101?


Don't fill 0 I don't confirm, that you make your own experiment and check the related information, but & amp; 1 the high qing 0, with only a low
Numbers 5 ASCII is 0 x35, this you understand that numerical 5 and character is not the same as
All stored on computer or display can be as a binary stream, it's just a matter of coding,

CodePudding user response:

refer to 6th floor walk every step response:

Thank you, I want to know, such as "|", in view of the character set GBK, how can I recognize the Chinese characters and |
Good | a total of three bytes
The characters of high bit must be the first, this no doubt, but the low byte highest can also be 1
Why this is the first and the second byte of double byte, and the third byte is single-byte?
Why isn't the first byte is single-byte characters, while the second (assuming the highest is 1) and the third byte constitutes a double-byte characters?