Facebook
From jd, 1 Week ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 41
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. typedef enum figure {
  5.     two = 1,
  6.     three,
  7.     four,
  8.     five,
  9.     six,
  10.     seven,
  11.     eight,
  12.     nine,
  13.     ten,
  14.     jack,
  15.     queen,
  16.     king,
  17.     ace
  18. } figure_t;
  19.  
  20. typedef enum suit {
  21.     spade = 1,
  22.     club,
  23.     heart,
  24.     diamond
  25. } suit_t;
  26.  
  27.  
  28. typedef struct karta {
  29.     figure_t figure;
  30.     suit_t suit;
  31. } karta_t;
  32.  
  33.  
  34. int main(){
  35.     int count = 0;
  36.     karta_t taliakart[52];
  37.    
  38.     for( int i = 1; i <= 4; i++ ) {
  39.         for( int j = 1; j<= 13; j++ ) {
  40.             taliakart[count].suit = (suit_t)i;
  41.             taliakart[count].figure = (figure_t)j;
  42.             count++;
  43.         }
  44.     }
  45.  
  46.     cout << taliakart[0].suit << endl;
  47.     cout << taliakart[0].figure << endl;
  48.    
  49.     cout << taliakart[24].suit << endl;
  50.     cout << taliakart[24].figure << endl;
  51.    
  52.     return 0;
  53. }
  54.