#include <vector>
#include <iostream>
#include <ctime>
#include <string>
using namespace std;
class Card
{
private:
string rank;
string suit;
int value;
public:
string getRank()
{return rank;}
string getSuit()
{return suit;}
int getValue()
{return value;}
Card() {}
Card (string rk, string st, int val)
{rank = rk; suit = st, value = val;}
void print() {cout << rank << "of" << suit << endl;}
};
class Deck
{
private:
Card deck[52];
int top;
public:
Card dealcard()
{return deck[top++];}
void shuffle(){}
Deck()
{
top = 0;
string ranks[13] = {"Ace", "King", "Queen", "Jack", "Ten", "Nine", "Eight",
"Seven", "Six", "Five", "Four", "Three", "Two"};
string suits[4] = {"Hearts", "Spades", "Diamonds", "Clubs"};
int values[13] = {11, 10, 10, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2};
for(int i = 0; i < 52; i++)
deck[i] = Card( Rank[i % 13], [i % 4], [i % 13]);
}
};
class Player
{
private:
vector<Card>hand;
double cash;
double bet;
public:
Player (double csh)
{
cash = csh;
bet = 0;
}
void hit(Card c)
{hand.push_back(c);}
int totalhand()
{
int count = 0;
for(int i = 0; i < (int)hand.size(); i++)
{
Card c = hand[i];
count = count + c.getValue();
}
return count;
}
// You need to create a new method here
void betMoney(int amount)
{
if ( cash - amount < 0)
cout << "Not enough money to bet."
else
{
// Put some code here
}
}
double getAmount()
{ return cash}
};
int main()
{
bet = 0
// Create the instances of the objects
Deck myDeck;
Player me(1000), dealer(0);
// Place a bet - I think you place a bet before you get your hand, though I'm not totally sure.
cout << "You have " << me.getAmount() << " of cash. Place amount to bet" << endl
cin >> bet
me.betMoney(bet) // This is where you call the betting method
Card c = myDeck.dealcard();
cout<<"Your first card is";
c.print();
me.hit(c);
c = myDeck.dealcard();
cout << "Dealer showing";
c.print();
dealer.hit(c);
c = myDeck.dealcard();
cout<<"Your second card is";
c.print();
me.hit(c);
c = myDeck.dealcard();
dealer.hit(c);
Card dealerHoldCard = c;
string answer;
cout << "More cards?";
cin >> answer;
while(answer=="yes")
{
c = myDeck.dealcard();
cout << "Your Card is";
c.print();
me.hit(c);
cout << "more?";
cin >> answer;
}
while(dealer.totalhand()<13)
{
//morecards
}
if(me.totalhand() > dealer.totalhand())
cout << "You win!" << endl;
else
cout << "The House Wins!" << endl;
//} /* You have an extra bracket here */
return 0;
}