Trouble with card game functions

I am currently writing a go fish program and am having some trouble manipulating my functions. For general context, here are my current functions:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
void shuffle(int ocean[]){//working 
int hold=0;
int i=0;
int n;
while ( i <31){
	n= 1 + rand() % 32;
	ocean[hold] = ocean[i];
	ocean[i] = ocean[n];
	ocean[n] = ocean[hold];
	i=i+1;
	}
}



int drawCard (int ocean[], int hand[], int& deckPos, int& handPos)
{
hand[handPos]=ocean[deckPos];
deckPos=deckPos + 1;
handPos = handPos + 1;
return deckPos;
return handPos;

}


void pairCount (int hand1[], int hand1Pos){
int count[11]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; //enough room to count all the occurences from 2 to 9
int temp;
for (int i=0; i<hand1Pos; i++){
	temp=hand1[i];
	count[temp]++;
	}
int x=2;
while (x<9){
if (count[x]==4){
	cout << "Game Over! Four occurences of " << x << " have occured " << endl;
	x=10;}//ends loop because a winner was found 
else {
	x++;}// if no winner is found at count[x], increment the counter 
}
}


int cardCheck (int guess, int hand1[], int& hand1Pos, int hand2[], int& hand2Pos, int ocean[], int& deckPos){


for (int i=0; i<hand2Pos; i++){//checking computer's hand for player's guess
if (hand2[i]==guess){
cout << "I do. I have one " << endl; //still need to figure out how to x occurences (not just one) 
hand1Pos++; //if the guess is in the opponent's hand, increment player's hand to prepare for the card to be added
hand1[hand1Pos-1]=guess; //add the guess to player's hand
hand2[i]=hand2[hand2Pos-1];
hand2Pos--;
return hand1Pos, hand2Pos, deckPos;
}
}

	
cout << "Go fish!" << endl;
drawCard(ocean, hand1, deckPos, hand1Pos);
return hand1Pos, hand2Pos, deckPos;

}


This game is to be played with a deck of 32 with cards from 2 to 9. If the player or the computer gets 4 of the same number, the game is over. Currently, my main concern resides with my cardCheck function, it works for single occurrences, however, I am not sure how to return how many occurrences of a given card. (For example, if I input guess to be 7, I want the computer to reply "I do. I have " x " amount of sevens.) Could somebody please point me in the right direction? If anything is unclear or you need to see the rest of my code please ask. Thanks.
Topic archived. No new replies allowed.