HEADER..

#include <string>
using std::string;
class Blackjack
{
  public:    
           
        Blackjack(string);  
        void Shuffle();
        void Intro(string);
        void InitDeck(Card deck[],int numCards);
        void PrintCard(int);
      //  void Card(int);     
             
             
             
  private:
          
        int deck[52];  //deck of 52 cards.

};

BODY

#include    <iostream>
#include    <fstream>
#include    <cctype>
#include    <cstdlib>
#include    <ctime>
using namespace std;

     
const int       NUM_CARDS = 52;
enum            { Spades, Clubs, Hearts, Diamonds };
enum            { JACK = 11, QUEEN, KING, ACE };


// type definitions
typedef int         SuitType;
typedef int         RankType;
typedef int         ValueType;


// structure declarations
struct  Card
{
    SuitType    suit;
    RankType    rank;
    ValueType   value;
};

#include "bj.h"

Blackjack::Blackjack(string name)
{
    Intro( name );
                      
}
void Blackjack::Intro(string name)
{
cout<<"##############################################################"<<endl;    
cout<<"Program done by" <<  endl;
cout<<"Lets define the basic rules::" << endl;
cout<<"##############################################################"<<endl;
system("PAUSE");


void Blackjack::InitDeck(Card deck[] int numCards)//what each card is

{
    auto    int         deckIndex = 0;
    auto    RankType    rankCounter;
    auto    SuitType    suitCounter;

    for (suitCounter = Spades; suitCounter <= Diamonds; ++suitCounter)
        {
        for (rankCounter = 2; rankCounter <= ACE; ++rankCounter)
            {
            // set the suit and rank members
            deck[deckIndex].suit = suitCounter;
            deck[deckIndex].rank = rankCounter;

            // set the value member
            if (ACE == deck[deckIndex].rank)
                {
                // if we have an ace, assign the highest possible value
                deck[deckIndex].value = 11;
                }
            else if (deck[deckIndex].rank >= JACK)
                {
                // if we have a face card, assign it a value of ten
                deck[deckIndex].value = 10;
                }
            else
                {
                // the rank of the card is its value
                deck[deckIndex].value = deck[deckIndex].rank;
                }
            ++deckIndex;
            }
        }

}  // end of "InitDeck"

MAIN

#include<iostream>


#include "bj.h"


//-------------------------------------------------------------------

int main(int argc, char *argv[])
{ 
int numCards=0; //to know what card you are on
Blackjack myBlackjack("welcome to blackjack");

myBlackjack.Shuffle();
myBlackjack.PrintCard(0);
myBlackjack.InitDeck(deck[],52);

//myBlackjack.InitDeck();



system("\nPAUSE");

return 0;
}


//-------------------------------------------------------------------

Error:
prototype for `void Blackjack::InitDeck(Card*)' does not match any in class `Blackjack'
void Blackjack::InitDeck(Card*, int)

??

Missing ',' huh....
see this..

void Blackjack::InitDeck(Card deck[] int numCards)
{
     //...
}

Ok i fixed that but now when i run main i get..

#include<iostream>


#include "bj.h"


//-------------------------------------------------------------------

int main(int argc, char *argv[])
{ 
int numCards=0; //to know what card you are on
int deck[52];
Blackjack myBlackjack("welcome to blackjack");

myBlackjack.Shuffle();
myBlackjack.PrintCard(0);
myBlackjack.InitDeck(deck[],52);

//myBlackjack.InitDeck();



system("\nPAUSE");

return 0;
}

variable or field `InitDeck' declared void
'class Blackjack' has no member named 'InitDeck'

/facepalm

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.