Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| 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 23rd, 2006, 06:05 PM
Authorized User
 
Join Date: Mar 2006
Location: , , .
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'.

  #2 (permalink)  
Old June 24th, 2006, 07:54 AM
Authorized User
 
Join Date: May 2006
Location: Iver, Bucks., United Kingdom.
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.'



  #3 (permalink)  
Old June 24th, 2006, 05:05 PM
Authorized User
 
Join Date: Mar 2006
Location: , , .
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.

  #4 (permalink)  
Old June 25th, 2006, 01:22 AM
Authorized User
 
Join Date: May 2006
Location: Iver, Bucks., United Kingdom.
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.

 


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
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



All times are GMT -4. The time now is 10:58 PM.


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