Server IP : 172.16.15.8 / Your IP : 18.188.76.209 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/bafreeman/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
// Pirate's Gold Game // August 2008 // Benjamin Freeman #include <iostream> #include <iomanip> #include <cstdlib> #include <ctime> #include "cardclass.cpp" void PlayPirateGame(DeckType deck); int main() { DeckType deck; srand(time(0)); deck.Shuffle(); PlayPirateGame(deck); return 0; } void PlayPirateGame (DeckType deck) { typedef CardType HandType[DECKSIZE]; HandType hand1, hand2; int tablecards, i,j,l; cout << "Pirate's Gold Game\n\n"; cout << "Orignal Cards on Table:\n"; for (i=0; i < 8; i++) // Select 8 cards from the deck. { hand1[i] = deck.DrawCard(); hand1[i].Print(); if (i==3) cout << "\n"; else cout << " "; } // Time to see if any of the cards match. for(i=0; i<8; i++) { for (j=0; j < 8; j++) { if (hand1[i].EqualFace(hand1[j])) // Two cards do match { hand1[j]=deck.DrawCard(); cout << " \n------------------------" << endl; cout << "Round " << i << endl; hand1[i].Print(); //if (j==3) // cout << "\n"; //else // cout << " "; cout << endl; //else // break; // cout << "\nYou lost.\n"; } if (deck.IsEmpty()) cout << "\nYou've won"; } } }