About the conflicting cases. Your asking the user to enter a trailing 1 after the hand number if the user has a soft hand, and a 2 if the user has a pair.
If the number is less than or equal to 21, you can assume it's neither a pair or a soft hand. You cannot have a number of 1, so 11 could only mean a hand number of 11. 21 cannot mean a soft hand number of 2 because a 2 is two aces, and thats a pair, -> 22.
And if they entered a number greater than 21, then you can assume it is a soft hand or they have a pair. You can differentiate between the two exploiting the fact that if it ends in a 2, then it's even, and if it ends in a 1, then its odd. So you can check just check if the number is even or odd.
Anyways, you can break your program up like this,
1 2 3 4 5 6 7 8
|
if (y > 2 && y < 22) { //then you know they don't have a soft hand or a pair
//add your lines 18 through 75
}
else if (y & 1){ //if it is not between 2 and 22, and the number is odd, then it must be a soft, so add your soft hand code
// instead of if (y & 1) you can use if ((y % 2) != 0), meaning if their is a remainder when y is divided by 2
}
else{ //it must be a pair, add your cases for pairs
}
|
Make sure to think over what i've written carefully, make sure you understand it, and evaluate for yourself, I may be wrong.
y & 1 is a bitwise operation.
http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/