 |
BOOK: Ivor Horton's Beginning Visual C++ 2010
 | This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2010 by Ivor Horton; ISBN: 9780470500880 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2010 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

May 23rd, 2013, 10:41 AM
|
|
Registered User
|
|
Join Date: May 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Facepalm *spoilers*
Just wanted to share that I spent 4 hours+ scratching my head on the second exercise of Chapter 2.
It basically reads:
Write a program that reads an integer into an int, and uses one of the bitwise operators to determine the positive remainder, when divided by 8.
I don't know about anyone else, but I took that literally: Use a bitwise operator to determine the remainder. Felt like pounding my head against the wall. Technically, while you use a bitwise operator to divide and multiply (discarding the remainder), to actually isolate the remainder, you use ordinary subtraction - a method which I'd figured out in the first five minutes. You can't isolate the remainder purely by using bitwise operators, at least not without maybe knowing binary and hexadecimal really well, which I don't.
Now I'm going to chill out and attempt to approach the rest of this book less logically >>
|
|

May 23rd, 2013, 12:44 PM
|
|
Authorized User
|
|
Join Date: May 2012
Posts: 66
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
Interloper,
Please read the whole reply. It seems a little off topic at first, but it concludes by addressing your frustration.
Yep, I had problems with this one also. I went from facepalm to lightbulb to slapforehead.
The lightbulb was an algebra classroom lecture (too many years ago) where we were asked how to solve a problem using a specific method similar to, "uses one of the bitwise operators to determine the positive remainder, when divided by 8," in the exercise. In unison the class said that the specific method would not supply the solution, like saying, "you can't isolate the remainder purely by using bitwise operators."
The teacher's reply was that the specific method was not the only tool available. It was simply a tool he required us to use. As long as we used the required tool, the use of other other appropriate tools in conjunction with the required tool to complete the solution satisfied his requirements.
He went on to give a real world example of given some wood, use a hammer to build a box. It is both appropriate and necessary to use a saw to cut the wood into the proper sizes and shapes and then use a hammer to complete the construction of the box.
He concluded by saying that the problem he had posed to the class was not intended to mechanically crunch out some numbers. It was intended to require thought.
The moral of the story is:
Don't, "attempt to approach the rest of this book less logically." Attempt to avoid taking it too literally. Being too literal can suppress thought. That is the slapforehead I experienced.
I hope this is both encouraging and helpful.
drpepper
|
|

May 24th, 2013, 03:23 AM
|
|
Registered User
|
|
Join Date: May 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for your reply. I did put significant thought into the ways the problem could be achieved, when taken literally. Think I rewrote the program 3-4 times but I wasn't satisfied that I was solving the issue as it had been presented - I didn't want to cheat, because I suspected maybe I was simply missing something in my understanding of the bitwise operators. This book was my first time reading about/using them. I also re-read the question about ten times to confirm I was reading it correctly -_-
I'm not normally one to think inside a box.. maybe except for when it comes to language. I take people literally. Independently, I would have solved the issue in the most efficient way I could see, in a couple of minutes.
Thanks for your reply, it was encouraging :)
|
|

May 24th, 2013, 11:10 AM
|
|
Authorized User
|
|
Join Date: May 2012
Posts: 66
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
You're welcome. I did gather that you put a lot of thought into the solution, and I applaud that. One word of warning about some of the exercises seems prudent.
I have run into some exercises which assume knowledge of concepts not covered in the book. I don't know if this is by intent to promote research, a product of revisions as newer Visual C++ are released, or other reasons. Just be forewarned. In a classroom environment the instructor can clarify these issues. Unfortunately I am studying the book as an independent learning project.
This brings me to the subject of the code supplied online. A couple of times I have had to resort to examining the solution (and maybe some supplemental research) to understand the recommended solution. I have also found that comparing my solution to the provided solution is instructive. Upon comparison I may find that there is a better, more concise, or cleaner solution to mine. I believe this will serve me better as I progress from the simple problem solving to more advanced programming. (Ugly code can present a problem when debugging or returning to the code at a later date to view it or add features to a program.) I just thought I'd share that with you.
Meanwhile the demands of everyday life have taken me away from my Visual C++ studies. I am starting over at Chapter 1 to refresh the skills I learned on the first go around.
I don't know if you like flowcharting or not, but I find it helpful when attacking more complex solutions or when reviewing code at a later date. It is a tool I like.
Good luck to you in your studies.
drpepper
|
|

May 24th, 2013, 04:47 PM
|
|
Registered User
|
|
Join Date: May 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for the tips :) I'm studying the book independently as well, coming from a rusty background in vanilla C++. I'll keep your suggestions in mind.
|
|

May 24th, 2013, 04:51 PM
|
|
Authorized User
|
|
Join Date: May 2012
Posts: 66
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
You're welcome. I'll stay subscribed to the forum.
|
|
 |
|