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 23rd, 2006, 06:05 PM
Authorized User
 
Join Date: Mar 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Enumeration

In chapter 2, the book discusses about Enumeration type.

The following code declare the 'week' enumeration type
enum Week : char{ Monday=’M’, Tuesday=’T’, Wednesday=’W’,
Thursday=’T’, Friday=’F’, Saturday=’S’, Sunday=’S’};


How do you refer to Saturday instead of Sunday in your code ? Please note that Saturday and Sunday denote 'S'.

 
Old June 24th, 2006, 07:54 AM
Authorized User
 
Join Date: May 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Does this provide the answer?

From page 62:

'enum Week : char{ Monday=’M’, Tuesday=’T’, Wednesday=’W’,Thursday=’T’, Friday=’F’, Saturday=’S’, Sunday=’S’};

Now the values for the constants reflect a little more what they represent, although they do not distinguish between Thursday and Tuesday or between Saturday and Sunday. There is no problem with having duplicate values for the constants, but of course, all the names must be unique.'



 
Old June 24th, 2006, 05:05 PM
Authorized User
 
Join Date: Mar 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Nick Y
 Does this provide the answer?

From page 62:

'enum Week : char{ Monday=’M’, Tuesday=’T’, Wednesday=’W’,Thursday=’T’, Friday=’F’, Saturday=’S’, Sunday=’S’};

Now the values for the constants reflect a little more what they represent, although they do not distinguish between Thursday and Tuesday or between Saturday and Sunday. There is no problem with having duplicate values for the constants, but of course, all the names must be unique.'
Thanks for your reply but it doesnt answer my question. My question is how do you distinguish between Saturday and Sunday because they have same value 'S' ? Demonstrative codes are welcomed.

 
Old June 25th, 2006, 01:22 AM
Authorized User
 
Join Date: May 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try EX2_14 on page 109. While it uses Clubs, Diamonds, Hearts and Spades, it will show you the difference between the names of the constants and their values. Look also at page 111.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Give an example program for Enumeration in Flexgri ramk_1978 Beginning VB 6 0 January 20th, 2005 09:06 AM
How to Use Enumeration in VB6 ramk_1978 VB How-To 1 December 6th, 2004 02:35 PM
AD Group enumeration raspar VB How-To 1 June 15th, 2004 02:18 PM
Enumeration tbriers VB How-To 0 March 30th, 2004 04:04 AM





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