class Card help

This is a discussion on class Card help within the C++ Programming forums, part of the General Programming Boards category; I am trying to make a class called Card with contains the face and suit and can read each card. ...

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    33

    class Card help

    I am trying to make a class called Card with contains the face and suit and can read each card. This is what i have so far but i am terrible with classes and am not sure
    exactly what to do.

    Code:
    class Cards
    {
    public:
    
    	Card(int card);
    	string getSuit() const;
    	string getPip() const;
    private: 
    	// METHODS  
    	// ATTRIBUTES  
    	int cardHolder;  
    	static const string CARD_PIP[];
    	static const string CARD_SUITS[];
    };





    Code:
    const string Card::CARD_PIP[] =  {"A", "2", "3", "4", "5", "6", "7"
                                        , "8", "9", "10", "J", "Q", "K"};
    const string Card::CARD_SUITS[] = {"Spades", "Hearts", "Clubs", "Diamonds"};
    
    
    Card::Card(int card)
    {
    	cardHolder = card;
    }
    string Card::getSuit () const
    {
    	return CARD_SUIT[cardHolder/13];
    }
    string Card::getPip () const
    {
    	return CARD_PIP[cardHolder%13];
    }

  2. #2
    Registered User
    Join Date
    Jun 2011
    Posts
    51
    class Card
    not
    class Cards

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. t.v. card
    By saurav_sarkar in forum Tech Board
    Replies: 6
    Last Post: 03-19-2005, 01:52 PM
  2. Template <class T1, class T2, class T3> error LNK2019
    By JonAntoine in forum C++ Programming
    Replies: 9
    Last Post: 10-11-2004, 01:25 PM
  3. 802.1x wireless card
    By axon in forum Tech Board
    Replies: 3
    Last Post: 09-11-2003, 12:09 PM
  4. PCI card
    By a1a14635 in forum Windows Programming
    Replies: 1
    Last Post: 03-20-2003, 08:21 PM
  5. ISA card in a PCI slot.
    By gamegod3001 in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 10-08-2001, 12:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21