1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#include "pch.h"
#include <iostream>
using namespace std;
#define NUMBER_OF_CARDS 52
enum SUIT { HEARTS};
struct Card {
SUIT suit; // H, D, S, C
int value; // A, 2,3,4,5,6,7,8,9,10, j,q,k
int score; // A = 1, 2 = 2, Q = 10
};
Card Pack[NUMBER_OF_CARDS];
void SetupPack();
void SetupHearts();
void displayPack();
int main()
{
SetupPack();
displayPack();
system("pause");
return 0;
}
void SetupPack()
{
SetupHearts();
}
void SetupHearts()
{
for (int loop = 0; loop <= 12; loop++)
{
Pack[loop].suit = HEARTS;
Pack[loop].value = loop + 1;
Pack[loop].score = loop + 1;
}
// score for jack, queen, king
Pack[10].score = 10;
Pack[11].score = 10;
Pack[12].score = 10;
}
void displayPack()
{
for (int loop = 0; loop < NUMBER_OF_CARDS; loop++)
{
cout << " Suit = " << Pack[loop].suit;
cout << " Score = " << Pack[loop].score;
cout << " Value = " << Pack[loop].value;
cout << endl;
}
}
| |