Wrox Programmer Forums
BOOK: Ivor Horton's Beginning Visual C++ 2005
This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2005 by Ivor Horton; ISBN: 9780764571978
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2005 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
Old June 24th, 2006, 07:16 PM
Authorized User
Join Date: Mar 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Comments and Questions for Chapter 2

Dear Ivor Hortons and readers of the Beginning Visual C++ book,

I have some thoughtful idea after reading halfway through chapter 2. I would like to share with you.

1. In Try It Out ( Exercising Basic Arithmetic) pg69
I realize that the author are not consistent in naming variable convention. You will notice that the author name a long variable
inconsistently i.e. name with and without a '_'
For examples : rollwidth, rolllength, nrolls
             strips_per_roll, strips_reqd
Consistent in naning variables will help you coding better and professional. I suggest either use the '_' for long variable or do not use '_' at all.
For example: rollwidth, rolllength, nrolls, stripsperroll, stripsreqd
OR roll_width, roll_length, n_rolls, strips_per_roll, Strips_reqd
In this particular case, using '_' makes your variable more readable and understandable.

2. Incremet and Decrement operators are very confusing topic because the position of the operator. If you do not sure how the position of the operator will affect your code (different C++ compiler and/or different version might give different result), I suggest writing extra lines because your code is clearer and easier to maintain.
For example:
Instead of writing : total = count++ +6;
You can write as : total = count + 6;
Fancy code is good but precision is first priority. What is the point of writing buggy fancy code or codes that you can not understand 6 months later.

3. On page 74, the author discusses about Modifying a Variable where we can write "lhs op = rhs" and op is any of the following operators :+ , - , * , /, % , << , >> , &, ^ , >
Can anyone explain how the << , >> , &, > operator work ? Demonstrative code are welcomed.

4. The Comma Operator on page 76 Ex2_06.cpp
can anyone tell me more about the comma operator usage in C++ ?
The example doesnt help much on understanding the comma operator
  num4 = (num1 =10, num2=20, num3=30); // num4 get the value 30
which equals to
  num4 = 30;
What is the point of using comma operator if we can write a shorter code ?

Thank you for reading.


Duy Nguyen

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 1 - Two questions mikener BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 6 March 17th, 2008 03:59 PM
Questions, Comments shane.perran BOOK: Beginning SharePoint 2007: Building Team Solutions with MOSS 2007 ISBN: 978-0-470-12449-9 0 May 31st, 2007 05:55 PM
Two Chapter 3 Questions psychonet BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 6 April 13th, 2007 11:39 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.