+ 1
how cout<<"0x7b = "<<0x7b<<endl; produces output: 0x7b = 123
also cout<<"0x123 = " << 0x123 << endl; output: 0x123 = 291 Now I'm learning number system such as binary, unary, hexadecimal. I read forums. But I can't understand this. Please help me!
3 odpowiedzi
+ 1
123 in hex: 3*16^0 + 2*16 + 16^2 = 3 + 32 + 256 = 291 in decimal
0
0x7b is hexadecimal, and its decimal form is 123, not 291.
0
it's all still the same statement for the output.