본문/내용
/*
파일명 : main.cpp
프로그램 : poker 프로젝트의 main함수 파일
내용 : 포커게임 시뮬레이션(가상실험) 프로젝트
작성자 : 손민균 200658117
작성일 : 2xxx. 11. 18.
*/
#include "poker.h"
int main(void)
{
int i, j;
card deck[52]; //52장의 카드로 이루어진 카드 한 덱
card hand[NPLAYER][5]; //플레이어가 가지는 카드들
srand((unsigned)time(NULL));
fill_deck(deck);
shuffle(deck);
//for(i=0; i<52; i++)
// print_card(deck[i]);
deal_cards(deck, hand);
for(i=0; i\n",
i, (is_flush(hand[i])? "Yes":"No"));
printf("< Player #%d : Straight? %s>\n",
i, (is_straight(hand[i])? "Yes":"No"));
for(j=0; j<5; j++){
print_card(hand[i][j]);
}
}
return 0;
}
/*
파일명 : function.cpp
프로그램 : poker 프로젝트의 함수 정의 파일
작성자 : 손민균 200658117
작성일 : 2xxx. 11. 18.
*/
#include "poker.h"
//52장의 카드로 이루어진 카드 한 덱을 채우기
void fill_deck(card *deck)
{
int i;
for(i=0; i<52; i++){
(deck+i)->suit=i/13;
(deck+i)->pip=i%13+1;
}
}
//주어진 카드의 무늬와 숫자를 출력하는 함수
void print_card(card mycard)
…