I would suggest using a pair, then you can compare each new pair to a vector of pairs:
First create the vector:
vector<pair<int,int>> deck;
Then inside your loop, create cards:
pair <int,int> card;
card.first = ((double)rand())/INT_MAX * 13;
card.second = ((double)rand())/INT_MAX*4;
Then use binary_search to add only non-duplicates to the deck:
if(!binary_search(deck.begin(), deck.end(), card)){
deck.push_back(card);
}
Here is a working prototype that probably suits your needs:
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
int main()
{
srand(time(0));
std::vector <std::pair<int,int>> deck;
for(int n = 0;n < 52;n++){
std::pair <int,int> card;
card.first = ((double)rand())/INT_MAX * 13;
card.second = ((double)rand())/INT_MAX*4;
if(!binary_search(deck.begin(), deck.end(), card)){
deck.push_back(card);
std::sort(deck.begin(), deck.end());
std::cout << "\n" << card.first << " " << card.second;
}else{
std::cout << "\ndiscarding duplicate: " << card.first << " " << card.second;
n--;
}
}
}
But Fei Xang's idea to just create a deck and shuffle it makes more sense.