Untitled

 avatar
unknown
plain_text
2 years ago
1.6 kB
6
Indexable
int calculatePoints(std::string hand[], int size){
    int score = 0;

    for (int i = 0; i < size; i++){

        if (hand[i] == "AH" || hand[i] == "AS" || hand[i] == "AC" || hand[i] == "AD"){
            score += 11;
        } else if (hand[i] == "2H" || hand[i] == "2S" || hand[i] == "2C" || hand[i] == "2D"){
            score += 2;
        } else if (hand[i] == "3H" || hand[i] == "3S" || hand[i] == "3C" || hand[i] == "3D"){
            score += 3;
        } else if (hand[i] == "4H" || hand[i] == "4S" || hand[i] == "4C" || hand[i] == "4D"){
            score += 4;
        } else if (hand[i] == "5H" || hand[i] == "5S" || hand[i] == "5C" || hand[i] == "5D"){
            score += 5;
        } else if (hand[i] == "6H" || hand[i] == "6S" || hand[i] == "6C" || hand[i] == "6D"){
            score += 6;
        } else if (hand[i] == "7H" || hand[i] == "7S" || hand[i] == "7C" || hand[i] == "7D"){
            score += 7;
        } else if (hand[i] == "8H" || hand[i] == "8S" || hand[i] == "8C" || hand[i] == "8D"){
            score += 8;
        } else if (hand[i] == "9H" || hand[i] == "9S" || hand[i] == "9C" || hand[i] == "9D"){
            score += 9;
        } else if (hand[i] == "10H" || hand[i] == "10S" || hand[i] == "10C" || hand[i] == "10D"){
            score += 10;
        } else if (hand[i] == "JH" || hand[i] == "JS" || hand[i] == "JC" || hand[i] == "JD" || hand[i] == "QH" || hand[i] == "QS" || hand[i] == "QC" || hand[i] == "QD" || hand[i] == "KH" || hand[i] == "KS" || hand[i] == "KC" || hand[i] == "KD"){
            score += 10;
        }

    }

    return score;
}
Editor is loading...
Leave a Comment