View Single Post
Old 04-29-2005, 12:06 PM   #6 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,545
Valmont is on a distinguished road
Hmm. We, especially me, don't like itoa() in this part of the forum.
You see, that function is supported by many compilers, but was never part of the ISO standard. Not in C, and not in C++. It wasn't even part of the American ANSI standards.

So we need a homebuilt function to do the conversion. We can make a fast one quite easely:
Code:
//Utility. Convert int to string.
string itos(int i)  
{
  stringstream s;
  s << i;
  return s.str();
}
And this is how you use it in your print_hand() function:
Code:
// Convert integer value to ascii
output = itos(DECK[hand[i]].value);
Now you can remove that "ugly" buffer (char c[5]) as well.

See if you like it.
I'll wait until you finished the rest.
__________________
Valmont is offline   Reply With Quote