118                                     4.     

void shuffle(deck& dk)     // 
{

card t ;

for (int i = 0; i < 52; ++i) {

int k = ((rand() % (52- i) ) ) ;

t = dk. d [ i ] ;

dk.d[i] = dk.d[k] ;

dk.d[k] = t;            //   
}
}

void deal(int n, int pos, card* hand, decks dk)
{           //

for (int i = pos; i < pos + n; ++i)
hand[i - pos] = dk.d[i];

void init_deck(deck& dk)   // 
{

for (int i = 0; i < 52; ++i)
assign(i, dk.d[i]);

)

 init_deck ()  assign ()      -
 .  shuffle()    -
  rand ()         . 
,        .
 deal ()           .

         , 
   .   ,    
(   ).

int main()
{

card one_hand[9];         // 9   

deck dk;

int i, j, k, fcnt = 0, sval[4];

int ndeal, nc, nhand;

do {

cout  "\   ? ( 5  9):";

 in  nc;

} while (nc < 5 II nc > 9) ;

nhand = 52 / nc;

cout  "\  ? ";

cin  ndeal;

s rand (time (NULL) );        //() "" rand ()
init_deck(dk);