*정*
Bronze개인
팔로워0 팔로우
소개
등록된 소개글이 없습니다.
전문분야 등록된 전문분야가 없습니다.
판매자 정보
학교정보
입력된 정보가 없습니다.
직장정보
입력된 정보가 없습니다.
자격증
  • 입력된 정보가 없습니다.
판매지수
전체자료 2
검색어 입력폼
  • [프로그래밍] 링크드 리스트를 이용한 포카드 게임 (1Player VS Computer)
    #include #include #define I_N 100 //입력받는 문자열의 갯수#define I_T 13 //입력받는 것의 종류(치트키종류)#define N 52 //카드수#define SETMONEY 1000000 //초기 돈#define PAN_DON 1000 //판돈typedef enum {clubs,hearts,diamonds,spades} cdhs;typedef struct CARDS{int pips;cdhs suit;} CARD; //포커카드 N개 구조체 선언typedef struct HAVE_CARDS{CARD card;struct HAVE_CARDS *prev;struct HAVE_CARDS *next;} HAVE_CARD; //가지고 있는 카드 구조체typedef struct PLAYERS{int id;HAVE_CARD have_card;int money;struct PLAYERS *prev;struct PLAYERS *next;} PLAYER; //플레이어들을 위한 구조체typedef struct SCORE_WIN{int id;int score;int top_pips;int low_pips;int top_suit;int low_suit;HAVE_CARD card;} SCORE; //점수를 내고 해당 카드를 받는 구조체int int_input(); //숫자를 입력받는 함수int rank(int); //족보의 순위를 결정하는 함수int first_money(); //처음에 돈을 나눠주는 함수int char_input(char *,int ); //문자를 입력받는 함수int find_suit(int,int); //모양을 찾아내는 함수int batting(char *,int *,int,int *); //배팅이나 치트키 구별하는 함수int load(char *,HAVE_CARD *,int *,int *,int *,int *,int *); //로드 함수int want(char *,HAVE_CARD *,int); //원하는 패를 바꾸는 함수char (tmp -> card.pips == pips && tmp -> card.suit == suit)break;tmp = tmp -> next;}while (tmp -> next != NULL && !flag){tmp = tmp -> next;cnt ++;}if (tmp -> next == NULL)if (tmp -> card.pips != pips || tmp -> card.suit != suit || !flag && cnt != 7){printf ("You Not Have That Card!n"); //없는경우 에러 메세지 출력return 0;}while (deck_top != d_head) //데크에 원하는 카드가 있는지 찾는다{if (deck_top -> card.pips == ch_pips && deck_top -> card.suit == ch_suit)break;deck_top = deck_top -> prev;}if (deck_top == d_head){printf ("Deck Not Have That Card!n");return 0;}tmp_card = deck_top -> card.pips; //자신의 카드와 원하는 카드를 교환deck_top -> card.pips = tmp->card.pips;tmp -> card.pips = tmp_card;tmp_card = deck_top -> card.suit;deck_top -> card.suit = tmp->card.suit;tmp -> card.suit = tmp_card;return 1;}void sort(int flag){PLAYER *node = p_head->next;HAVE_CARD *tmp,*tmp2;while(node != p_tail){tmp = &(node -> have_card);if(!flag)tmp = tmp -> next -> next;while(tmp -> next != NULL) //버블정렬 앞에서 부터 큰거를 뒤로 보내서 제일작은걸 제일 앞으로 오게 한다{tmp2 =ey -= *call_money;*money += *call_money;printf ("Player %d call!n",player);return 1;case 4: //wantreturn 6;case 5: //helpprintf ("n You Can Type End,Load,Save,Want,Half,Quarter,Call nn");return 2;case 6: //viewview_all(1,1);return 2;case 7: //balancebalance();return 2;case 8: //sortsort(0);view_all(0,1);return 2;case 9: //endreturn 3;case 10: //savereturn 4;case 11: //loadreturn 5;case 12: //cheatreturn 7;default:return 0;}}return 0;}int load(char *input,HAVE_CARD *deck_top,int *call_money,int *tmp_call_money,int * end_flag,int *winner,int *money){FILE *fp;char tmp[300],*p_tmp;int pips,suit;PLAYER *node = p_head,*new_node;HAVE_CARD *c_node,*new_c_node;if(strchr(input,' ')!=NULL)input = strchr(input,' ')+1;elsestrcpy(input,"end.stu");if((fp = fopen(input,"r"))==NULL){printf ("Load Error n");return 0;}else{free_player_card(); //플레이어들이 가지고 있는 카드 초기화clean_player(); //플레이어 초기화deck_top = d_head; //데크의 탑을 데크의 헤드로 옮김fscanf (fp,"%sn",&tmp); //파일에서 한줄씩 읽어드림p_tmp=tmp;while(strchr(p_tmp,'[')");break;case 3:printf ("Triple n");break;case 2:printf ("Two Pairn");break;case 1:printf ("One Pairn");break;case 0:printf ("No Cardn");break;}}void free_player_card(){int cnt=0,cnt2=0;PLAYER *node = p_head->next;HAVE_CARD *tmp,*tmp2;while (node != p_tail) //플레이어들의 카드 노드 삭제{tmp2 = node->have_card.next;node -> have_card.next = NULL;while (tmp2 -> next != NULL){tmp = tmp2;tmp2 = tmp2 -> next;free(tmp);}free(tmp2);node = node -> next;}}SCORE * score_card(int player,int flag) //flag 가 1이면 오픈된 카드만 계산{int pips[14]={0},suit[4]={0},straight_cnt=0,straight_flag=0,card_cnt=0,i,j;PLAYER *node = p_head;HAVE_CARD *tmp;SCORE *s_node;while(node -> id != player) //플레이어를 찾는다.node = node -> next;tmp = &(node->have_card);if(flag)tmp = tmp -> next -> next;while(tmp -> next != NULL){pips[tmp->card.pips-1]++;suit[tmp->card.suit]++;tmp = tmp -> next;card_cnt++;}if(flag && card_cnt == 4);else{pips[tmp->card.pips-1]++;suit[tmp->card.suit]++;}if(!flag)sort(1);pips[13]=pips[0]; //1과 14로 동시에 쓰이는 As_node = (S(tmp -> card.pips = s_node -> top_pips){score_in_card(s_node, tmp -> card);card_cnt ++;}tmp = tmp -> prev;}if(card_cnt != 3 && tmp -> card.pips == s_node -> top_pips)score_in_card(s_node, tmp -> card);break;}}while (tmp -> next != NULL)tmp = tmp -> next;if(s_node -> score == 3){for (i = 12; i >= 0; i--){if(pips[i] == 2 && i != s_node -> top_pips - 1){s_node -> score = 6;s_node -> low_pips = i+1;s_node -> low_suit = find_suit(i+1,player);}card_cnt = 0;if(s_node -> score == 6 && !flag){while(tmp -> card.pips != s_node -> low_pips)tmp = tmp -> prev;while(tmp -> prev != NULL && card_cnt != 2){if(tmp -> card.pips == s_node -> low_pips){score_in_card(s_node, tmp -> card);card_cnt++;}tmp = tmp -> prev;}if(card_cnt != 2 && tmp -> card.pips == s_node -> low_pips)score_in_card(s_node, tmp -> card);break;}}}while(tmp -> next != NULL)tmp = tmp -> next;card_cnt = 0;for (i = 0 ; i < 13 && s_node -> score < 2; i++) //투페어&원페어{if(pips[i] == 2){s_node -> score ++;s_node -> low_pips = s_node -> top_pips;
    공학/기술| 2004.04.06| 28페이지| 1,000원| 조회(970)
    미리보기
  • [프로그래밍] 더블 스택(Double Stack)을 이용한 공학용 계산기 (ANSI C)
    #include #include #include #include #define N 100#define AR_NUL -999.1023#define ARRAY_N 100//계산 완료//괄호 처리 완료//단일 변수 사용 완료//배열 변수 사용 완료//소수점 처리 완료//세이브 완료 로드 루틴 완료//수학함수 사용 frexp//aa+bb완료//수학함수 숫자확인//주석double byunsu[26]={AR_NUL}; //단일변수 공간 할당double array[26][ARRAY_N]={AR_NUL}; //배열변수 공간 할당double array_calculator[ARRAY_N]={AR_NUL}; //배열개산 공간 할당//수학함수들을 인자구분으로 문자열 생성char *function1[] = {"asin","acos","atan","sin","cos","tan","cosh","sinh","tanh","exp","log","log10","ceil","floor","fabs","sqrt"};char *function2[] = {"add","mul","avg","std"};char *function3[] = {"atan2","fmod","pow","frexp","ldexp","modf"};int char_input(char [],int); //입력받는 함수void ch_letter(char [],int); //대문자를 모두 소문자로 변환 하는 함수double calculator(char [],int,int); //계산기 몸체 함수void space_remove(char [],int *,int); //공산을 삭제해주는 함수int error_chk(char [],int); //에러 체크 함수int token_chk(char *,char ); //토큰 체크 함수int token_rank(char *, char *); //토큰의 순위를 메기는 함수int token_num(char *); //토큰의 번호를 명명하는 함수double calculator_real(char *,double *, double *,int); //실질적인 계산이 이뤄지는 함수char *strstr_tok(char *,char); //토큰을 찾아내는 함수void input_array(char *,int); //변수에 집어넣는 함수void clean_input(char *); //입력받은 변수 초기화하는 함수void clean_byunsu(); //모든 변수 초기화int find_function(char *); //수학함수를 찾아내는 함수double function_calculator(char *,int); //수학함수를 계산하는 함수int find_last_par(char *); //괄호의 마지막을 찾아내는 함수double add(double *); //배열인자를 받는함수 4개double mul(double *);double avg(double *);double std(double *);int save(char *); //세이브 함수int load(char *); //로드 함수int main(){int char_length,i,j;char input[N];double result;clean_byunsu();for(i = 0; i < ARRAY_N; i++)array_calculator[i]=AR_NUL;printf ("Start ...n");usleep(40000);printf (" ----------------------------------------------------------------------------------n");usleep(40000);printf ("| ##### ### ## ##### ## ## ## ### ###### ##### ###### |n");usleep(40000);printf ("| ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## |n");usleep(40000);printf ("| ## ## # ## ## ## ## ## ## ## # ## ## ## ## ## ## |n");usleep(40000);printf ("| ##### ## ## ###### ##### ###### ###### ## ## ## ##### ## ## |n");usleep(40000);printf (" ----------------------------------------------------------------------------------n");usleep(40000);printf (" |V1.1 Made By Stun |n");while(1){printf ("Input : ");clean_input(input);char_length=char_input(input,N);ch_letter(input,char_length);if (input[0] == 'e' && input[1] == 'n' && input[2] == 'd' && input[3] == '')break;else if (input[0] == 's' && input[1] == 'a' && input[2] == 'v' && input[3] == 'e' && input[4] == ' ')save(input);else if (input[0] == 'l' && input[1] == 'o' && input[2] == 'a' && input[3] == 'd' && input[4] == ' ')load(input);else{space_remove(input,&char_length,1);switch (error_chk(input,char_length)){case 2:space_remove(input,&char_length,0);if (input[0] == input[1]){if(input[2] != '['){printf("%s = {",input);for(i = 0; i < ARRAY_N ; i++)if (array[input[1]-97][i] != AR_NUL){printf("[%d] %lf",i,array[input[1]-97][i]);break;}for(i++ ; i < ARRAY_N ; i++)if (array[input[1]-97][i] != AR_NUL)printf(",[%d] %lf",i,array[input[1]-97][i]);printf("}n");}elseprintf("%s = %lfn",input,array[input[1]-97][atoi(input+3)]);}elseprintf("%s = %lfn",input,byunsu[input[0]-97]);break;case 1:if((result=calculator(input,0,char_length))!=AR_NUL)printf("Result : %lfn",result);else{for(i = 0; i < ARRAY_N; i++)if (array_calculator[i]!=AR_NUL)printf ("[%d] %lfn",i,array_calculator[i]);}break;case -1:input_array(input,char_length);break;case -2:printf ("Undefined Symboln");break;default:printf("Syntex Errorn");}}for (i = 0 ; i < ARRAY_N; i++)array_calculator[i]=AR_NUL;}printf ("Endn");}int char_input(char input[],int limit){int cnt=0,length=0;char tmp=EOF;while (tmp == EOF || tmp == '')tmp = getchar();while (tmp != 'n'){if (cnt < limit){input[cnt]=tmp;cnt ++;}tmp = getchar();length ++;}input[cnt]='';return length;}void ch_letter(char input[],int limit){int i;for (i = 0 ; i < limit ; i++)if(input[i] >= 'A' && input[i]
    공학/기술| 2004.04.06| 18페이지| 1,000원| 조회(899)
    미리보기
전체보기
해캠 AI 챗봇과 대화하기
챗봇으로 간편하게 상담해보세요.
2026년 05월 02일 토요일
AI 챗봇
안녕하세요. 해피캠퍼스 AI 챗봇입니다. 무엇이 궁금하신가요?
7:59 오전
문서 초안을 생성해주는 EasyAI
안녕하세요 해피캠퍼스의 20년의 운영 노하우를 이용하여 당신만의 초안을 만들어주는 EasyAI 입니다.
저는 아래와 같이 작업을 도와드립니다.
- 주제만 입력하면 AI가 방대한 정보를 재가공하여, 최적의 목차와 내용을 자동으로 만들어 드립니다.
- 장문의 콘텐츠를 쉽고 빠르게 작성해 드립니다.
- 스토어에서 무료 이용권를 계정별로 1회 발급 받을 수 있습니다. 지금 바로 체험해 보세요!
이런 주제들을 입력해 보세요.
- 유아에게 적합한 문학작품의 기준과 특성
- 한국인의 가치관 중에서 정신적 가치관을 이루는 것들을 문화적 문법으로 정리하고, 현대한국사회에서 일어나는 사건과 사고를 비교하여 자신의 의견으로 기술하세요
- 작별인사 독후감