![]() So how could you use hexadecimal to make a secret message? Well, every letter in the alphabet has a number assigned to it, and you could just convert that number into base sixteen. Seems a little confusing, doesn't it! But did you know that your calculator may have a command to convert regular numbers into hexadecimal? You should check it out! So our final base sixteen (hexadecimal) number is: 3FC5 And now we're left with a remainder of 5, and there are no more powers of 16 to divide it by, so I guess we'll just have to tack it on the end. How do we write a 12 in hexadecimal? It's a C. Well, if you're still reading, next we need to take that 197 and divide it by 16. Shall we keep going? Or have you had enough? And we still have a remainder of 197 to deal with. (Are you confused yet?) Now our first two digits of our hexadecimal number are 3 and F. But look up above at my list of hexadecimal numbers, and you see that whenever we have a 15, we can call it F. WAIT A MINUTE! 15 isn't a digit! That's right. How many times does 256 go into 4037? (256 is 162, remember) The answer is 15, with a remainder of 197. The first digit of our hexadecimal number is going to be 3, and we need to do some more work with the remainder. Now we ask the question: How many times does 4096 go into 16,325? And the answer is: 3. To begin, we need to find the largest power of 16 that's less than that number.Īh hah! 163 (4096) is what we're looking for. How do you convert any number to hexadecimal? Well, let's take an example. Take a look at how these numbers look in hexadecimal:ġ0 = #A, 11 = #B, 12 = #C, 13 = #D, 14 = #E, 15 = #F That can be a little confusing, because now when we write numbers in hexadecimal, they can actually have LETTERS in them! But you get used to it after awhile. I know! We'll call the other digits A, B, C, D, E, and F. 0 through 9, but then we still need six more digits! Hmmm. ![]() But to do that, you'd need sixteen digits. Wouldn't that be WILD! Well, if you had sixteen fingers, you'd count in base sixteen, which is hexadecimal. So imagine you had sixteen fingers instead of just ten. In fact, sometimes we refer to our fingers as digits! ![]() In base ten, we have ten digits - 0 through 9. Normally we count in what's called Base Ten, and we probably do that because we only have ten fingers. So how does hexadecimal work? Well, hexadecimal is the same as Base Sixteen. Since the computer doesn't normally speak hexadecimal, we're really just saying, "Hello computer, I thought you should know, I'm going to talk to you in hexadecimal now!" Well, that's what we're doing when we put a "#" or a "&H" in front of hexadecimal code. It's kind of like if you were talking to a friend in Pig Latin, before you started, you might say to him "I'm going to talk in Pig Latin now", just so he'd know what you're doing. Sometimes we put a pound sign (#) in front of the code, and sometimes we put an ampersand followed by an H (&H). Sometimes we use different symbols sometimes to indicate that we're talking to a computer in hexadecimal. For instance, I wanted to color this page dark purple, I wouldn't tell the computer to paint it "dark purple", I would tell the computer to paint it "#440044", and the computer understood exactly what I meant (see the link about colors at the bottom of this page for more information about encoding colors). It's easier to read than Binary code, but a whole lot harder to read than English! As computers get more sophisticated, we programmers use hexadecimal less and less, but we still use it sometimes. But that is very hard for humans to read, so computer programmers have a special code they use when talking to computers it's called Hexadecimal Code. Computers "think" in Binary code, or Base Two.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |