Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > BOOK: Ivor Horton's Beginning Visual C++ 2005
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 24th, 2006, 07:16 PM
Authorized User
 
Join Date: Mar 2006
Location: , , .
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
Ex2_05.cpp
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;
                 count++;
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.

Sincerely,

Duy Nguyen
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:41 AM.


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