Distributing cards to players in C++ I have written this program to deal 7 cards to one player.

#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;cstdlib&gt; //for rand and srand
#include &lt;cstdio&gt;
#include &lt;vector&gt;
using namespace std;

string suit[] = {"Diamonds", "Hearts", "Spades", "Clubs"};
string facevalue[] = {"Two", "Three", "Four", "Five", "Six", "Seven",         "Eight", "Nine", "Ten", "Jack", "Queen", "King", "Ace"};
int numberOfCardsDrawn = 0;
string drawnCards[52];

string drawCard () {
    string card;
    int cardvalue = rand()%13;
    int cardsuit = rand()%4;
    card += facevalue[cardvalue];
    card += " of ";
    card += suit[cardsuit];
    return card;
}


bool isMyCardAlreadyDrawn (string card) {
    for(int i = 0; i &lt; 52; i++) {
        if(card.compare(drawnCards[i]) == 0) { 
            // if this is true, then both strings are the same
            return true;
        }
    } 
    return false; 
    // if the code reaches this point, then the card has not   been drawn yet
}

string getCard () {
    srand(time(0));
    string card = drawCard();
    while (isMyCardAlreadyDrawn(card) == true) { 
        // keep drawing until an    undrawn card is found
        card = drawCard(); // draw a new card
    }
    drawnCards[numberOfCardsDrawn] = card;
    numberOfCardsDrawn++;
    return card;
}

int main () {
    cout &lt;&lt; "Your Cards:\n";
    vector&lt;string&gt; p0; //player 0's card
    const int DEAL_CARDS = 7; //number of cards we can deal to each player
    string choices[] = { "a", "b","c","d","e","f","g" };

    for (int i = 0; i &lt; DEAL_CARDS; i++){
        string p0_getCard = getCard();
        cout &lt;&lt;" " &lt;&lt; choices[i] &lt;&lt; ")"&lt;&lt; p0_getCard &lt;&lt; " ";
        p0.push_back(p0_getCard);
    }
}


However, I will eventually want to have a five-player game (dealing cards to four more vectors), and I feel that extending this code to accomplish that would result in excessive code duplication.  How do I go about improving the code to support that?
I see a number of things which may help you improve your code.

Don't abuse using namespace std

Especially in a very simple program like this, there's little reason to use that line.  Putting using namespace std at the top of every program is a bad habit that you'd do well to avoid.  

Don't reseed the random number generator more than once

The program currently calls srand at the top of each call to getCard(), but this is really neither necessary nor advisable.  Instead, just call it once when the program begins and then continue to use rand() to get random numbers.  Better yet, use the next suggestion.

Consider using a better random number generator

You are currently using 

int cardsuit = rand()%4;


There are two problems with this approach. One is that the low order bits of the random number generator are not particularly random, so neither with cardsuit be.  On my machine, there's a slight but measurable bias toward 0 with that.  The second problem is that it's not thread safe because rand stores hidden state.  A better solution, if your compiler and library supports it, would be to use the C++11 `std::uniform_int_distribution.  It looks complex, but it's actually pretty easy to use.

Eliminate global variables where practical

Having routines dependent on global variables makes it that much more difficult to understand the logic and introduces many opportunities for error.  Eliminating global variables where practical is always a good idea, whether programming for desktop machines or for embedded systems.  For global variables such as drawnCards and `numberOfCardsDrawn, consider wrapping them in objects to more easily keep them synchronized.

Use object-oriented programming

The game is written much more in the procedural style of C rather than in the object-oriented style of C++.  The cards and the deck could each be an object, with most of the procedures as functions of those objects.  This would reduce coupling and make the program easier to understand.  

Eliminate "magic numbers"

This code is littered with "magic numbers," that is, unnamed constants such as 4, 13, 52, etc.  Generally it's better to avoid that and give such constants meaningful names.  That way, if anything ever needs to be changed, you won't have to go hunting through the code for all instances of "52" and then trying to determine if this particular 52 means the total number of cards or some other constant that happens to have the same value.

Use const where practical

In your isMyCardAlreadyDrwan routine, the passed card is never altered, which is just as it should be.  You should indicate that fact by declaring it like this:

bool isMyCardAlreadyDrawn (const std::string&amp; card)