Using System; using System. collections. generic; using System. linq; using System. text; using System. threading. tasks; namespace ConsoleApplication3 {class Program {static void Main (string [] args) {Console. writeLine ("0x {0: x}", 0xf8 & 0x3f); Console. read ();}}}
In this Code, "0x {0: x}" and 0xf8 & 0x3f are not very familiar to me. Therefore, I would like to ask the teacher to check the Internet and get some results. I 'd like to share with you now.
First, this Code is designed to convert binary to hexadecimal, and second, it also involves the problem of "and.
0x {0: x} indicates to print the result of the phase "and" 0xf8 & 0x3f "in hexadecimal format. If it is less than 8, add 0.
So what does f mean? In binary format, 1111 is converted to a decimal value of 15. Therefore, f8 is expressed as 1111 1000 in binary format, while 3f is 0011 in binary format.
Speaking of "and", I want to talk about the logical relationship.
You can check the meanings of operators in the middle. Now we use "and". Therefore, we can determine the position corresponding to f8 and 3f to get the following result: 0011 1000 is converted to binary 38.