Here is some more C++, I am just posting it here to dump it somewhere to show it to someone with 1337 hacks. Please disregard if this sort of thing bores or confuses you. ^_^
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
struct cards {
string face;
string suit;
int value;
bool dealt;
};
string face_choice[13] = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
int value_choice[13] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10};
cards deck[52];
cards your_card[52];
void initial_deck()
{
int n(0);
for (n=0; n<52; n++)
{
deck[n].dealt=0;
if ((n/13) == 0)
{ deck[n].suit="Hearts";
deck[n].face=face_choice[n];
deck[n].value=value_choice[n];}
if ((n/13) == 1)
{ deck[n].suit="Diamonds";
deck[n].face=face_choice[n-13];
deck[n].value=value_choice[n-13];}
if ((n/13) == 2)
{ deck[n].suit="Clubs";
deck[n].face=face_choice[n-26];
deck[n].value=value_choice[n-26];}
if ((n/13) == 3)
{ deck[n].suit="Spades";
deck[n].face=face_choice[n-39];
deck[n].value=value_choice[n-39];}
}
}
void deal (int d_num)
{
int n (0);
srand((unsigned)time(0));
int random_integer(0);
int lowest=0, highest=51;
int range=(highest-lowest)+1;
cout << "Here are your card(s): " <
for ( n=0; n < d_num; n++)
{ random_integer = lowest+int(range*rand()/(RAND_MAX + 1.0));
if (deck[random_integer].dealt != 1)
{your_card[n]=deck[random_integer];
cout<< endl << your_card[n].face << " of " << your_card[n].suit << " which is worth " << your_card[n].value;
deck[random_integer].dealt=1;}
}
}
int main ()
{
int deal_number;
initial_deck();
cout << "How many cards do you want? (0-52)" << endl; cin >> deal_number;
if ((deal_number > 52) || (deal_number < 0)){
cout << "Sorry, there aren't that many cards in the deck!" << endl;}
else if (deal_number == 0)
cout << "That's cool, I didn't want to give you cards anyway!" << endl;
else
deal(deal_number);
return 0;
}
sneaky






