Server IP : 172.16.15.8 / Your IP : 3.129.69.134 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/vnlaughlin/../grpatillo/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
/* File Name: pirategold.cpp Author: R.P. Patillo Instructor: Dr. Ames Due Date: Sept. 4, 2008 Complilation: g++ pirategold.cpp -o pirategold.out Execution: ./pirategold.out */ #include <iostream> #include <iomanip> #include <cstdlib> #include <ctime> #include "cardclass.cpp" using namespace std; void PlayPirateGold (DeckType deck); const int GAMETABLE = 8; int main() { DeckType deck; srand(time(0)); deck.Shuffle(); deck.Shuffle(); deck.Shuffle(); PlayPirateGold (deck); return 0; } //-------------------------------------------------- void PlayPirateGold (DeckType deck) { typedef CardType HandType[GAMETABLE]; HandType card; int gameround, i, j; bool cardmatch = true; int i = 0; for (i = 0; i < GAMETABLE, i++) { card[i] = deck.DrawCard(); } gameround = 0; cout << "\nOriginal Cards on Table" << endl; cout << "-----------------------\n" << endl; for (i = 0; i < GAMETABLE; i++) { card[i].Print(); cout << " \t"; } cout << "\n\nTable After Each Round of Game" << endl; cout << "------------------------------" << endl; while (cardmatch && !deck.IsEmpty()) { i = 0; cardmatch = false; while (i < GAMETABLE && !cardmatch) { j = i + 1; while (j < GAMETABLE && !cardmatch) { if (cardmatch) { card[j] = card[i] card[i] = deck.DrawCard(); gameround++; cout << "\n\nRound " << gameround << "\n" << endl; for (i=0; i<8; i++) { card[i].Print(); cout << " \t"; } } else i++; } if (handround == 22) { cout << "\n**************************************" << endl; cout << "**** Congrats!!!! You Win!!!! ****" << endl; cout << "**************************************" << endl; i = 8; if (deck.IsEmpty() == false) { cout << "\n**************************************" << endl; cout << "***** Sorry!!! You Lose!!! *****" << endl; cout << "**************************************" << endl; } }