Site hosted by Angelfire.com: Build your free website today!

Ready To Start the 2003-2004 School year and ready to rebuild this entire website for you all links are empty as of now due to no information to fill them but as the imformation somes in the pages will be filled with it

Brad.
Don't Put Your Mouse Here


Whitewright High

School Teams
Varsity Softball Team
Tennis Team
Click Here For The Time




#include #include #include #include #define BELL '\a' #define DEALER 0 #define PLAYER 1 #define ACELOW 0 #define ACEHIGH 1 void dispTitle(void); void initCardsScreen(int cards[52], int playerPoints[2], int dealerPoints[2], int total[2], int * numCards); int dealCard(int * numCards, int cards[52]); void dispCard(int cardDrawn, int points[2]); void totalIt(int points[2], int total[2], int who); void dealerGetsCard(int *numCards, int cards[52], int dealerPoints[2]); void playerGetsCard(int *numCards, int cards[52], int playerPoints[2]); char getAns(char mesg[]); void findWinner(int total[2]); main() { int numCards; int cards[52], playerPoints[2], dealerPoints[2], total[2]; char ans; do {initCardsScreen(cards, playerPoints, dealerPoints, total, &numCards); dealerGetCard(&numCards, cards, dealerPoints printf("\n"); playerGetsCard(&numCards, cards, playerPoints); do { ans = getAns("Hit or Stand (H/S)? "); if (ans == 'H') { playerGetsCard(&numCards, cards, playerPoints); } } while (ans != 'S'); totalIt(playerPoints, total, PLAYER); do { dealerGetsCard(&numCards, cards, dealerPoints); } while (dealerPoints[ACEHIGH] < 17); totalIt(dealerPoints, total, DEALER); findWinner(total); ans = getAns("\nPlay again [Y/N]? "); }while (ans == 'Y'); return; } void initCardsScreen(int cards[52], int playerPoints[2], int dealerPoints[2], int total[2], int *numCards) { int sub, va1 = 1; char firstName[15]; *numCards = 52; for (sub = 0; sub <= 51; sub++) { val = ( == 14) ? 1 : val; cards[sub] = val; val++; } for (sub = 0; sub <=1; sub++) {playerPoints[sun]=dealerPoints[sub]=total[sub]=0;} dispTitle(); if (askedForName == 0) { printf("\nWhat is your name? "); scanf(" %s", firstName); askedForName = 1; printf("Ok, %s, get ready for casino action in Mr. Bodine's room!\n\n", firstName); getchar(); } return; } void playerGetsCard(int *numCards, int cards[52], in playerPoints[2]) { int newCard; newCard = dealCard(numCards, cards); printf("You draw: "); dispCard(newCard, dealerPoints); } {int cardDrawn, subDraw; time_t t; srand(time(&t)); subDraw = (rand() % (*numCards)); cardDrawn = cards[*numCards - 1]; (*numCards)--; return cardDrawn; } { switch (cardDrawn) { case(11) : printf("%s\n", "Jack"); points[ACELOW] += 10; points[ACEHIGH] += 10; break; case(12) : printf("%s\n", "Queen"); points[ACELOW] += 10; points[ACEHIGH] += 10; break; case(13) : printf("%s\n", "King"); points[ACELOW] += 10; points[ACEHIGH] += 10; break; default : points[ACELOW] += cardDrawn; if (cardDrawn == 1) {printf("%s\n", "Ace"); points[ACEHIGH] += 11; } else { points[ACEHIGH] += cardDrawn; printf("%d\n", cardDrawn);} } return; } { if ((points[ACELOW] == points[ACEHIGH]) || (points[ACEHIGH] > 21)) {total[who] = points[ACELOW]; } else {total[who] = points[ACEHIGH];} if (who == PLAYER) {printf("You have a total of %d\n\n", total[PLAYER]);} else {printf("The house stands with a total of %d\n\n", total[DEALER]);} return; } void findWinner(int total[2]) { if (total[DEALER] == 21) { printf("The house wins.\n");