Code:
#ifndef __DECK_H__
#define __DECK_H__
//=============================================================================
//
// File : Deck.h
//=============================================================================
// Author :
// Date : Tuesday, June 28, 2011 9:42 AM
// Summary :
//
// Description:
//
// Revisions :
//
//=============================================================================
// SYSTEM INCLUDES
#include <iostream>
#include <stdlib.h>
#include <time.h>
// PROJECT INCLUDES
// LOCAL INCLUDES
#include "Card.h"
// USING STATEMENTS
using std::cout;
using std::cin;
using std::endl;
// FORWARD REFERENCES
// CONSTANTS
// TYPEDEFS
// FUNCTION PROTOTYPES
// STRUCT DECLARATIONS
// CLASS DECLARATIONS
#pragma region CLASS_DECLARATION Deck
// class Deck
// Author :
// Date : Tuesday, June 28, 2011 9:44 AM
// Summary :
//
//
// Invariants
//
// Revisions:
//
class Deck
{
public:
// CONSTRUCTION
// Default constructor.
// Summary :
Deck( );
// Copy Constructor.
// Summary :
Deck( const Deck& from );
// Destructor.
// Summary :
~Deck( );
void shuffle(void);
void printDeck(void);
// METHODS
protected:
private:
// METHODS
// ATTRIBUTES
Card mDeck[52];
};
// NON-MEMBER FUNCTIONS
#pragma endregion
#endif //__DECK_H__
Code:
#include "Deck.h"
Deck::Deck()
{
string suits[4] = {"Spades" , "Hearts" , "Clubs" , "Diamonds"};
string pips = "234567890JQKA";
for(int i= 0; i < 52; ++i)
{
mDeck[i] = Card(suits[i/13],pips[i%13+2]);
}
}
Deck::~Deck()
{
}
void Deck::printDeck(void)
{
for( int i = 0; i < 52; ++i)
{
mDeck[i].printCard();
cout<<endl;
}
}
void Deck::shuffle(void)
{
srand ( time(NULL) );
for (int i = 0; i <1024; ++i)
{
int index1, index2;
index1 = rand() %52;
index1 = rand() %52;
Card tmp = mDeck[index1];
mDeck[index1] = mDeck[index2];
mDeck[index2] = tmp;
}
}
The errors are:
Code:
Error 1 error C2661: 'Card::Card' : no overloaded function takes 2 arguments
Error 3 fatal error LNK1104: cannot open file '..\debug\cards.lib' TestCards