void classify_parts(string& next_char, ifstream& in_stream,
string card_value[], string card_suit[],
string& bet,string& player1_hand )
//seperates hand into components. i.e. bet, card value and suit.
{
int i=0;//is a count to increase the index of the arrays
while(!in_stream.eof())
{
in_stream>>next_char;
while(is_card_value(next_char))
{
card_value[i]+=next_char;
}
while (is_card_suit(next_char))
{
card_suit[i]=(next_char);
}
i++;
cout<<i<<endl;
while (is_bet(next_char,bet))
{
bet+=next_char;
cout<<bet<<endl;
}
}
for(i=0;i<NUMBER_OF_CARDS_IN_A_HAND;i++)
{
player1_hand+= (card_suit[i]);
player1_hand+= (card_value[i]);
player1_hand+= (SPACE);
}
player1_hand+= (DOLLAR_SIGN);
player1_hand+= (bet);
cout<<player1_hand;
}
it doesn't seem to be putting any values into the player1_hand string
bool is_card_value(string next_char)
//checks if a character is possibly a card value and returns true if it is
//returns false otherwise
{
/* if(next_char=='a'||next_char=='A'||next_char=='j'||next_char=='J'
||next_char=='k'||next_char=='K'||next_char=='Q'||next_char=='q'
||isdigit(next_char))
return (true);
else
return (false);*/
for(int i=0;i<NUMBER_OF_CARD_VALUES;i++)
{
if((CARD_VALUES[i]) == next_char)
;
{
return(true);
}
}
return(false);
}
bool is_bet(string next_char, string& bet)
//checks if next char is a possible bet and if so adds that character to bet
{
for(int i=0;i<10;i++)
{
if(next_char==INTERGERS[i])
{
return(true);
}
return(false);
}
}
i also have it cout messages after each of the function and the only one i get is the one that follows is card suit and i get it an infinite number of times