#include <iostream> #include <cmath> #include <iomanip> using namespace std; void deckShuff(ocean[]){ // shuffles the deck int position = 0; int i = 0; int n = 1 + rand() % 32; while (i < 31){ ocean[i] = ocean[n]; i = i +1; } } void drawCard( const int ocean[31], int& position, const int[]){ // simulates the drawing of a card from the deck playerHand[] = playerHand[] + ocean[position] ocean[31] = ocean[31] - ocean[position]; position = position +1; } int ocean[35] = {2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9}; // arrays for values int playerHand[20]; int computerHand[20]; int position = 0; void checkcards(const int[], int rank, int size) { // checks hand for how many of a specific type of card int i = 0; int rankcount = 0; while (i < size) if (playerHand[i] ==rank) rankcount = rankcount + 1; i = i+1; } } void checkforset(const int[], int rank, int size, int points) { // checks a players hand for a set of cards int i = 0; int rankcount = 0; while (i < size) if (playerHand[i] ==rank) rankcount = rankcount + 1; if (rankcount == 4){ points = points + 1; cout << "A set of " << rank << "s was in the hand. A point has been scored" << endl; } i = i+1; } } void askforcards(const int[], int rank, int size, const int[], int size2) { // simulates the trading of cards between players int i = 0; while (i < size){ if computerHand[i] == rank){ playerHand[size2] = playerHand[size2] + computerHand[i]; computerHand[size] = computerHand[size] - computerHand[i]; } else if computerHand[i] != rank){ cout << "Go Fish!" << endl; drawCard } i = i +1; } } int main(){ int start = 0; int choice = 0; while (choice == 1){ cout << "Welcome to Go Fish!. Press 1 to play "<< endl; cin >> start; while (start != 1){ cout << "Press 1 to play " << endl; cin >> start; } deckShuff(ocean[]); int n = 0; // counters for loops int y = 0; while (n <= 5){ drawCard(ocean[], position, playerHand[]); drawCard(ocean[], position, computerHand[]); n = n+1; } cout << "Would you like to play again? (1 = yes, 0 = no) " << endl; cin >> choice; } }

MOD EDIT: When posting code...USE CODE TAGS!!!

This post has been edited by **JackOfAllTrades**: 15 November 2010 - 12:21 PM