Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 4.0 aka C# 2010 > BOOK: Beginning Visual C# 2010
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Visual C# 2010
This is the forum to discuss the Wrox book Beginning Visual C# 2010 by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, ; ISBN: 9780470502266
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C# 2010 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 September 17th, 2013, 06:32 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Sep 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch10CardLib - Deck class

Hi all, I am new to C# and new to this forum. Decided to learn c# two months ago and started with Beginning Visual C#2010. Didnt need any help till now. Maybe its really simple, but I just dont see it. I just dont get the following in bold (the 13 at least makes sence, feeling whise, since there are 13 cards per suit, but I really cant place the -1):

public class Deck
    private Card[] cards;
    public Deck()
        cards = new Card[52];
        for (int suitVal = 0; suitVal < 4; suitVal++)
            for (int rankVal = 1; rankVal < 14; rankVal++)
                 cards[suitVal * 13 + rankVal -1] = new Card((Suit)suitVal,
I could also a check up so could everyone be so kind to explain what happens line by line and put special focus on the part in bold? Much appreciated.


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 3 - Modeling a deck of cards saltima BOOK: Beginning Mac OS X Programming 0 August 15th, 2012 12:48 PM
[Modeling a Deck of Cards] question Almakos BOOK: Beginning iOS Game Development 2 May 3rd, 2012 01:44 AM
Chapter 3, pg 68 - Shuffling the Deck of Cards maconspace BOOK: Beginning iOS Game Development 11 March 11th, 2012 08:28 AM
calling a parent class method from a child class (Zend Cert) crmpicco Beginning PHP 2 July 30th, 2010 04:22 AM

All times are GMT -4. The time now is 06:59 PM.

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