This is a small program I wrote for GCSE computing, it operates using Vectors and that's pretty much it, wondering if you could tell me if there is anything I could do better.BlackJackv2.cpp#include BlackJack v2.hint main() {    // Create Vector with the players, using vec because of an undiefined amount   of players    std::vector<Players> VecPlayers;    // StrLine for entering players      std::string StrLine = ;    // Used as an index for VecPlayers    unsigned int CountPlayer = 0;    // Give players that are playing then add them to the vector    std::cout << Please give the players.\n: ;    while (std::cin >> StrLine) {        if (StrLine == .) break;        VecPlayers.push_back(Players());        VecPlayers[CountPlayer].Name = StrLine;        CountPlayer++;        std::cout << : ;    }    // Clear the input buffer    std::cin.ignore('/n');    std::cin.clear();    // Reset CountPlay so that it starts at the first index value    CountPlayer = 0;    // Answer used for user input    char Answer = 'N';    do {        // Seed for RNG        srand(int(time(NULL)));        // Start the turn of the player and say his name        std::cout << std::string(100, '\n') << VecPlayers[CountPlayer].Name << 's Turn: ;        // Press enter to continue        std::cin.ignore();        // Give the player two cards        VecPlayers[CountPlayer] = AddCard(VecPlayers[CountPlayer], 2);        // Show the player the cards        DisplayCard(VecPlayers[CountPlayer]);        // Add the cards to together and show them        VecPlayers[CountPlayer] = SumCard(VecPlayers[CountPlayer]);        // Ask if they want another card and ask for input        std::cout << std::endl << Do you want another card? Y/N? \n:;        std::cin >> Answer;        // If they want another card        while (Answer == 'Y') {            // Give the player one card            VecPlayers[CountPlayer] = AddCard(VecPlayers[CountPlayer], 1);            // Show all the playerscards            DisplayCard(VecPlayers[CountPlayer]);            // Add the cards toghether            VecPlayers[CountPlayer] = SumCard(VecPlayers[CountPlayer]);            // If your cards sum is less than or equal to 21            if (VecPlayers[CountPlayer].Sum <= 21) {                // Ask if the want another card                std::cout << std::endl << Do you want another card? Y/N? \n:;                std::cin >> Answer;                // Capitalise all input so no need for or operator                Answer = toupper(Answer);            }            // If they have too many cards            else {                std::cout << Bust! Bad luck, the RNG gods were not on your side! << std::endl;                // Exit the while loop                break;            }        }        // If the current player is the last player in the vector        if ((VecPlayers.size() - 1) == CountPlayer) {            // GreatestSum is used to see who has the best set            // WinnersIndex stores the winners index            int GreatestSum = 0, WinnersIndex = 0;            // Go through each index to see who has the largest sum            for (unsigned int Count = 0; Count < VecPlayers.size(); Count++) {                // Added so that new rounds have no cards                VecPlayers[Count].Cards = 0;                // If the current sum from the vector is the largest found then that is the winner                if (VecPlayers[Count].Sum > GreatestSum && VecPlayers[Count].Sum < 22) {                    // Assign the Sum of the current player to GreatestSum                    GreatestSum = VecPlayers[Count].Sum;                    // Assign the Index of the current player to WinnersIndex                    WinnersIndex = Count;                }            }            // Print out the winners name and sum of his cards            std::cout << std::string(100, '\n') << The winner is  << VecPlayers[WinnersIndex].Name                <<  with the sum of  << VecPlayers[WinnersIndex].Sum << \n:;            // Press enter to continue            std::cin.ignore();            CountPlayer = 0;        }        else CountPlayer++;        std::cin.ignore();    } while (true);    return 0;}BlackJack v2.h#include <iostream>#include <string>#include <vector>#include <time.h>struct Players {    std::string Name = ;    unsigned int Wins = 0;    unsigned int Cards = 0;    int Sum = 0;    unsigned int IndexSuit[10] = { 0 }; // Suit is from 0 to 3    unsigned int IndexCard[10] = { 0 }; // Card is from 0 to 12};int RandomNumber(int Start, int End) {    int RNG = (rand() % End) + Start;    return RNG;}Players AddCard(Players Player, unsigned int NumberCards) {    for (unsigned int Count = 0; Count < NumberCards; Count++) {        Player.IndexSuit[Player.Cards] = RandomNumber(0, 3);        Player.IndexCard[Player.Cards] = RandomNumber(0, 12);        Player.Cards++;    }    return Player;}void DisplayCard(Players Player) {    // Displays Suit of card     const std::string CardSuit[] = { Hearts, Diamonds, Clubs, Spades };    // Displays Name of card    const std::string CardName[] = { Ace, Two, Three, Four, Five, Six,         Seven, Eight, Nine, Ten, Jack, Queen, King };    std::cout << You have: << std::endl << std::endl;    for (unsigned int CardCount = 0; CardCount < Player.Cards; CardCount++) {        std::cout << The  << CardName[Player.IndexCard[CardCount]] <<  of              << CardSuit[Player.IndexSuit[CardCount]] << std::endl;    }    return;}Players SumCard(Players Player) {    Player.Sum = 0;    for (unsigned int CardCount = 0; CardCount < Player.Cards; CardCount++) {        if (Player.IndexCard[CardCount] < 10) {            std::cout << (Player.IndexCard[CardCount] + 1);            Player.Sum = Player.Sum + (Player.IndexCard[CardCount] + 1);        }        else if (Player.IndexCard[CardCount] == 0) {            std::cout << You have an Ace, (H)igh or (L)ow? \n: << std::endl;            char Answer = ' ';            std::cin >> Answer;            if (Answer == 'H') {                std::cout << 11;                Player.Sum = 11;            }            else {                std::cout << 1;                Player.Sum = 1;            }        }        else {            std::cout << 10;            Player.Sum = Player.Sum + 10;        }        if ((CardCount + 1) == Player.Cards) std::cout <<  = ;        else std::cout <<  + ;    }    std::cout << Player.Sum << std::endl;    return Player;}
Multiplayer BlackJack using Vector
c++;beginner;playing cards;vectors
You should write self documenting code.This basically means breaking your code up into logical well named units. Units are functions and classes. Classes should represents objects in your system.I would have layed out main something like this:int main(){     std::vector<Player>    players = getPlayers();     Shoe                   cards(6); // initialize with 6 decks.     for(;;) {        Game    game(players, cards);        game.dealCards();        for(player: players) {            game.getExtraCards(player);        }        game.getExtraCards(); // for the dealer.        game.payWinners();     }}Couple of classes I would build: Game:    A class to hold state about the current game. Player:  A class to hold state about players Cards:   A class to hold the different types of cards.          Mainly so they are easy to print. Shoe:    A class to hold all the cards from several decks of cards.          So you can deal from the deck. Then shuffle when you have          used all the cards.Seeding Random Numbersrand(int(time(NULL)));You should seed the random number generator only once during an application run. By seeding it multiple times you ruin the distribution. So move this out of the loop and put it just after main starts.Random Number generation.int RandomNumber(int Start, int End) {    int RNG = (rand() % End) + Start;    return RNG;}This is probably the anti pattern for getting a rand number (and it has a bug). This is because the space is for random numbers is not even so the chance for any particular number is not the same.The rand() function generates a number in the range 0-RANDMAX. For arguments sake lets say RANDMAX 32768. Your want a number in the range 1-6.This means. 1:   Probability:  5462/32768   // Notice this has a slightly higher probability 2:   Probability:  5462/32768   // Notice this has a slightly higher probability 3:   Probability:  5461/32768 4:   Probability:  5461/32768 5:   Probability:  5461/32768 6:   Probability:  5461/32768The Bug: Start = 8; End   = 10; int RNG = (rand() % End) + Start;  // Number in the range.  8 -> 17The better way to write this is:int RandomNumber(int start, int end) {    int rng = end - start + 1;    int max = RANDMAX / rng * rng; // Integer arithmetic so will be                                   // less than RANDMAX if it does                                   // not divide exactly.    int rnd;    // Get a value from [0, max)    // Discards numbers outside the range.    // So that each number has an equal probability.    do {        rnd = rand();    }    while(rnd >= max);    // Generate the result.    return (rnd % rng) + start;}Also rand() is old and is known to be pretty bad. You should be using the new random number generator that was provided in C++11 to solve this specific problem.http://en.cppreference.com/w/cpp/numeric/randomGenerating a pack of cardsPlayers AddCard(Players Player, unsigned int NumberCards) {    for (unsigned int Count = 0; Count < NumberCards; Count++) {        Player.IndexSuit[Player.Cards] = RandomNumber(0, 3);        Player.IndexCard[Player.Cards] = RandomNumber(0, 12);        Player.Cards++;    }    return Player;}The problem here is that you are likely to get a couple of cards that are the same (thus stacking your deck slightly).What you should do is generate all the cards you expect to find in the deck then shuffle the deck to get a random order.class Shoe{    std::vector<Card>                  cards;    std::vector<Card>::iterator        nextCard;       std::random_device                 rd;    std::mt19937                       randomGenerator;    public:        Shoe(int numberOfDecks)            : randomGenerator(rd)        {            // Create all the cards.            for(int deck = 0;deck < numberOfDecks; ++deck) {                for(int card=0; card < 52; ++card) {                    cards.push_back(Card(card));                }            }            shuffle();       }       void shuffle()       {            std::shuffle(std::begin(cards), std::end(cards), randomGenerator);            nextCard = std::begin(cards);       }       Card  deal()       {           if (nextCard == std::end(cards)) {               shuffle();           }           return *nextCard++       }}