p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Ivor Horton's Beginning Visual C++ 2005 (http://p2p.wrox.com/forumdisplay.php?f=249)
-   -   Ch 2 - Ex 2 (http://p2p.wrox.com/showthread.php?t=64886)

jkiernander December 29th, 2007 08:47 PM

Ch 2 - Ex 2
 
The solution given to this in the Word document seems to provide the quotient * 8 rather than the remainder.

So for the example of 29 the solution provided ((number >> 3) << 3) gives 24 rather than 5:

11101 >> 3 = 00011 (3)

00011 << 3 = 11000 (24)

I believe a correct solution would be (number & 7):

11101 (29)
&&&&&
00111 (7)
=====
00101 (5)





All times are GMT -4. The time now is 01:09 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.