HEADER FILE:
#include <string>
using std::string;
class Blackjack
{
public:
Blackjack(string);
void Shuffle();
void Intro(string);
void InitDeck();
void PrintCard(int);
// void Card(int);
private:
int deck[52]; //deck of 52 cards.
};
BODY PROGRAM.
#include <iostream>
#include <fstream>
#include <cctype>
#include <cstdlib>
#include <ctime>
using namespace std;
#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::Shuffle()
{
//int deck[52];
srand(time(0));
int b;
for( b = 0; b < 52; b++ ){
deck[b] = b+1;
}
int t;
for (int i=0; i<(52-1); i++)
{
int j = i + (rand() % (52-i));
int temp = deck[i];deck[i]=deck[j];deck[j]= temp;
}
int card1=deck[0];
int card2=deck[1];
int card3=deck[2];
int card4=deck[3];
cout << "human has "<< deck[0] << " " << deck[2]<< endl;
cout<<" computer has" << deck[1] <<" " << deck[3] << endl;
}
void Blackjack::PrintCard(int temp)
{
// Print Rank
const int kiRank = (temp % 13);
if (kiRank == 0) {
cout << 'A';
} else if (kiRank < 9) {
cout << (kiRank + 1);
} else if (kiRank == 9) {
cout << 'T';
} else if (kiRank == 10) {
cout << 'J';
} else if (kiRank == 11) {
cout << 'Q';
} else {
cout << 'K';
}
// Print Suit
const int kiSuit = (temp/13);
if (kiSuit == 0) {
cout << 'C';
} else if (kiSuit == 1) {
cout << 'D';
} else if (kiSuit == 2) {
cout << 'H';
} else {
cout << 'S';
}
}
MAIN PROGRAM
#include<iostream>
#include "bj.h"
//-------------------------------------------------------------------
int main(int argc, char *argv[])
{
Blackjack myBlackjack("welcome to blackjack");
myBlackjack.Shuffle();
myBlackjack.PrintCard();
//myBlackjack.InitDeck();
system("PAUSE");
return 0;
}
//-------------------------------------------------------------------
I'm pretty much an idiot in C++, i get the following errors..
no matching function for call to `Blackjack::PrintCard()'
candidates are: void Blackjack::PrintCard(int)
Also will that even properly associate the random generated # with it's corresponding card value?