Blackjack program, having problems with the ace
The program works fine instead for the ace.. I am going to post partial parts of the program here so you get the main idea how the program works. If you need the full code I will PM it to you...
Now as you know (or may not) in blackjack ace can be counted as 1 or 11 according to your total score. If your total score, with the ace dealt, is smaller than 21 it is counted as 11, if it is bigger than 21 it is counted as 1.
I am aware I have to change card_values 13 to card_values 14...
#define CARD_VALUES 13
int aces, twos, threes, fours, fives, sixes, sevens, eights, nines, tens, jacks, queens, kings;
int initPlayerScore, initDealerScore, newPlayerScore, newDealerScore;
no problem here..
aces = 4; twos = 4; threes = 4;
fours = 4; fives = 4; sixes = 4;
sevens = 4; eights = 4; nines = 4;
tens = 4; jacks = 4; queens = 4;
kings = 4;
addedScore = DealCard() + DealCard();
int card, cardValue;
card = 1 + (int) rand() % CARD_VALUES;
if (card == 1)
cardValue = 1;
printf("\t dealt an ace\n");
else if (card == 2)
cardValue = 2;
printf("\t dealt a two\n");
So this is how I have written it.. I hope it is understandable..
How on the hell am I going to make ace take two values..??