www.digitalmars.com         C & C++   DMDScript  

c++ - Hexadecimal arithmetic... Love Math? Good! *Heeelp!*

reply "Aurura" <aurura ev1.net> writes:
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I went ahead and started reading "Who's Afraid of C++?" as suggested.  =
Surprisingly, I also became more and more intrigued.  It was actually =
starting to help me better understand places where I was getting stuck =
in my other studies of C. =20

I'm utterly *terrible* at math, but as I continued to study all this =
comp. science, a light in some dark, unused part of my brain began to =
slowly brighten, and I was beginning to understand!  Eureka!!

...of course, that would be the point where I crash into some kind of =
math problem that completely trashed my new natural high.

And, here it is!

Using the hexadecimal system, answer this problem:

1a + 2e =3D

Welp, 'Susan' said she got 48 for an answer.  Well, I got 41.  Not only =
was I waaay off, but when I saw how the answer *should* be worked out, =
it knocked me into next week!  (meaning it blew me away)

...and, here's how it's worked out!

1(1 * 16) + a(10 * 1)=20

2(2 * 16) + e(14 * 1)=20

------------------=20

3(3 * 16) + 18(24 * 1 =3D 1 * 16 + 8 * 1)=20


"Carry the 1 from the low digit to the high digit of the answer, to =
produce:=20

4(4 * 16) + 8(8 * 1), or 48 hex, which is the answer"

Well, I could only figure just so many guesses as to what all this =
means.  But all in all, I honestly have no clue. =20

All I can figure is:

* In a multi-tasked math problem, division and multiplication are worked =
out before addition and subtraction.

* I'm guessing that the 4 parts to the problem represent the 4 places in =
a binary code that altogether make up a hexadecimal.  How "way off" am I =
still?  Probably very...


Would anyone who is gifted (to any lengths) in the realms of math and =
comp. science be willing to share in the gift and please help me out?  =
My math knowledge only goes as far as a small crumb of geometry.

Thanks a Million,

Me
Sep 21 2002
parent Jan Knepper <jan smartsoft.cc> writes:
 * In a multi-tasked math problem, division and multiplication
 are worked out before addition and subtraction.

Yes, the order is supposed to be 1. Power 2. Multiply 3. Divide 4. Add 5. Substract In Dutch we had this simple line: "Meneer Van Dalen wacht Op Antwoord". Where the caps stand voor de first letters of the words (in Dutch of course) that present these 5 operations.
 * I'm guessing that the 4 parts to the problem represent the 4
 places in a binary code that altogether make up a
 hexadecimal.  How "way off" am I still?  Probably very...

I am not exactly sure what the question is here. As it does not quite dawn on me what the problem is in: 1A 2E+ ---- Jan
Sep 21 2002