A community for students.
Here's the question you clicked on:
 0 viewing
halkazi
 3 years ago
In chap 12, we are asked to
"As an exercise, create and print a Point object, and then use id to print the object's unique identifier. Translate the hexadecimal form into decimal and confirm that they match."
I got an identifier " 0x02B41468".
What does x represent in Hex? If I am able to convert this to Decimal, with what do I have to match it?
halkazi
 3 years ago
In chap 12, we are asked to "As an exercise, create and print a Point object, and then use id to print the object's unique identifier. Translate the hexadecimal form into decimal and confirm that they match." I got an identifier " 0x02B41468". What does x represent in Hex? If I am able to convert this to Decimal, with what do I have to match it?

This Question is Closed

rsmith6559
 3 years ago
Best ResponseYou've already chosen the best response.00x is the traditional C way of denoting that the following number is hexadecimal. 0 by itself denotes octal.

andrew.m.higgs
 3 years ago
Best ResponseYou've already chosen the best response.0Yes, as Rsmith6559 says, everything after the 0x is the actual hex value. In this case, 02B41468.

halkazi
 3 years ago
Best ResponseYou've already chosen the best response.0Thanks. Ok, so I converted it to Decimal 45,356,136. With what should I match this. Is there a function that will return the Id in Decimal?

rsmith6559
 3 years ago
Best ResponseYou've already chosen the best response.0If you have the code that produced the identifier, there's a formatted print command in there to print it out. If we're talking a C based language, it could well be printf(). Usually in the format string, %x or %X is used for hex and %d is used for decimal. Your best bet would be to duplicate the line and have one with an x and one with the d.

halkazi
 3 years ago
Best ResponseYou've already chosen the best response.0I guess the exercise is not making sense to me. What do I get by converting an object identifier from Hex to Decimal, and verifying it using a formatting command.

rsmith6559
 3 years ago
Best ResponseYou've already chosen the best response.0Converting it is a valid exercise, but without the answer you can't be sure that you're right. One way to cheat (it's ethical if it's only to check to see if what you got is right or wrong) is to hack the formatted print statement and let the computer give you the answer.

exchaoordo
 3 years ago
Best ResponseYou've already chosen the best response.0I have the same question as halkazi: I understand hex and I can convert the id to decimal, but the question says "see if they match." See if WHAT matches?

exchaoordo
 3 years ago
Best ResponseYou've already chosen the best response.0#halkazi, did you ever get a real answer to this? I came up with: 49595656, with what is one supposed to match it? I don't get the thing about hacking formatted print statements etc.

rsmith6559
 3 years ago
Best ResponseYou've already chosen the best response.0Most languages use something like C's printf statement's formatting strings. This means that when you print a hexadecimal integer, you format it with "%x". If you want to print it as decimal, the format would be "%d". If you have the code, find the line that prints out the hex. Make an exact duplicate of that line on the next line, and change the "%x" to "%d" and recompile and run it.
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.