I am trying to see if a the second character is equal to an 1, J, Q, K, or A. I then want to set a Boolean for each of these cases. This is a blackjack program am writing.
The deck is dealt and a single card is evaluated
Card is a string that a given a random value from an array of cards, the value would be something like “HK”
bool delt1 = card[1].Equals("1");
bool deltJ = card[1].Equals("J");
bool deltQ = card[1].Equals("Q");
bool deltK = card[1].Equals("K");
bool deltA = card[1].Equals("A");
But I receive an “Index was outside the bounds of the array” error
any suggestion?
This will probably fix your problem but you likely have others: