Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* okay here is the first attempt at this code
- to generate a deck of cards that has the
- attributes of a standard deck. Next trick is
- to get it to randomly choose a number
- and suite
- class standards are
- -implement a deck class that represents a deck of 52 cards
- -public interface should include methods to shuffle
- deal
- display hands
- do a pair-wise comparision of cards (e.g a queen beats a jack
- -to simulate shuffling use a random number generator*/
- #include <iostream>
- #include "card.h"
- using std :: cout;
- using std :: endl;
- card ::gen_card()
- {
- public:
- int s = suit; //suite i.e club, spade, etc
- int f = face ; //2-10, Ace King Quenn, Jack
- card.suite = rand*4;
- card.face = rand*13;
- }
- suite get_suite() { return card_suite; }
- enum suite { diamond, heart, spade, club };
- enum face { two, three, four, five, six, seven, eight, nine,
- ten, jack, queen, king, ace };
- class card deck [52]
- {
- bool exists [4] [13];
- suite = suite_value;
- face = face_value;
- for (int x=0; x<4; x++)
- for (int x=0: y<13; y++)
- EXISTS [x] [y]=FALSE;
- for (int I = 0; I<52; I++)
- }
- DO
- {
- deck[I].gen_card.suite_value = rand*4 + diamond;
- face_value = rand*13+two;
- deck[I].get_suite()
- }
- UNTIL (!EXISTS [suite_value] [face_value]);
- EXISTS [suite_value] [face_value] = TRUE;
- deck[I].set_face (face_value);
- deck[I].set_suite(suite_value);
- }
Add Comment
Please, Sign In to add comment