Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- class graphics{
- public:
- int bufferStream[60][60];
- public:
- graphics(){
- bufferStream[1][1] = 110;
- cout << bufferStream[1][1];
- }
- private:
- };
- class Deck{
- private:
- int deck[52];
- int cardsInDeck = 52;
- public:
- Deck(){
- int nsetUpCounter = 0;
- cout << "setting up the deck one moment" << endl;
- while (nsetUpCounter <= 53){
- deck[nsetUpCounter] = 1;
- cout << nsetUpCounter << " : " << deck[nsetUpCounter] << endl;
- nsetUpCounter++;
- }
- cardsInDeck = 52;
- cout << "all set up " << endl;
- }
- public:
- void shuffleDeck(){
- cardsInDeck = 52;
- int x = 0;
- while (x != 52){
- deck[x] = 1;
- cout << x << " : " << deck[x] << endl;
- x++;
- }
- cout << "shuffled";
- }
- public:
- void drawCard(){
- int ntestCard = 0;
- int ncountCard = 1;
- while (ncountCard == 1){
- if (cardsInDeck == 0){
- cout << "no more caaaaaaards" << endl;
- ncountCard = 0;
- }
- else{
- ntestCard = rand()%52;
- if (deck[ntestCard] == 1){
- ncountCard--;
- cardsInDeck--;
- cout << "you drew : " << ntestCard << " leaving " << cardsInDeck << " cards in the deck" << endl;
- deck[ntestCard] = 0;
- }
- }
- }
- }
- public:
- void readOutDeck(){
- int x = 0 ;
- while (x <= 51){
- cout << "card " << x << " is " << deck[x] << endl;
- x++;
- }
- }
- };
- int main(){
- Deck de;
- graphics ge;
- int x = 1;
- int z;
- int check = 1;
- while (x != 0){
- cin >> x;
- z = x;
- if (x == 111){
- de.shuffleDeck();
- }
- else if (x == 112){
- de.readOutDeck();
- }
- else{
- while (z > 0){
- de.drawCard();
- z--;
- }
- }
- cout << "ITERATION " <<check << endl;
- check++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement