When i run this code, it will sometimes create legitimate numbers, but usually creates really high numbers. Could someone tell me what i'm doing wrong?
Firstly, some (most) of the functions you made for your Dealer class have return types of int, but do not return a value. In some compilers that may work, but is generally a no no. If there's no reason to return a value, change the function return types to void.
Also, you need to initialize your variables.
1 2 3 4 5 6 7 8 9 10 11 12
int dealer::Hit()
{
int card; //needs to be: int card = 0;
int sel; //needs to be: int sel = 0;
string suit;
card = GetCard();
numofcards = numofcards + 1;
checkFive();
sel = rand() % 5;
switch (sel)
...
Initializations like that should be made for every variable, because when your program allocates memory for it, it doesn't automatically assume 0. It's got whatever value is in the memory area already.
After applying that, the program compiles fine, and doesn't give me those wacky numbers.