ÇÁ·Î±×·¡¹Ö

 3206, 2/161 ȸ¿ø°¡ÀÔ  ·Î±×ÀΠ 
   yyy3399
   ÇÙ¸Ç ÄÚµå Áú¹®

http://www.hackerschool.org/HS_Boards/zboard.php?id=QNA_programming&no=6592 [º¹»ç]


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

void drawMan(int life);
void game(void);

char *voca[] = {"accolade","adamant","admonition","affable","affinity","aftermath","ailing","aisles","amenable","amidst","among","apocryphal","appall","arousal","assuage","awash","bared","barely","bear","beef","beg","bend","bend","beneath","bequest","besiege","bet","bind","binge","blade","blasphemy","blast","blazing","blister","blow","blunt","boast","bobbing","bolster","bout","brag","brash","breed","brevity","bribe","brusque","burden","burglary","burst","cacophony","calf","callus","captivity","cartons","catering","cattle","cease","censure","chimera","chuckle","churning","claim","clam","clamor","clash","clemency","clever","clumsy","clutch","coalesce","cock","coeds","cognizant","come about","commiserate","complaisant","comprised","concealed","concern","contract","convey","convict","copious","copper","couch","crap","craze","crop","crotch","culprit","cumbersome","curl","dainty","dairy","dare","dart","dawn","dazzling","deaf","dean","dearth","decadence","decay","deceive","deed","defy","demise","denim","dentures","depleted","deputy","desultory","deter","devise","diatribe","dimple","dire","disgruntled","dispassionate","distress","donor","downwind","doze","draped","dreary","drizzling","drowziness","dull","dumb","duplicity","duty","dye","ease","edge","edifice","eerie","effervescent","eloquent","embrace","endowed","endure","enmity","equivocal","erroneous","exemplary","expedient","exuberance","fad","faint","fair","fancy","fast","feat","feather","fetter","fidget","fizz","flair","flare","flaw","fledgling","flood","flunk","folly","footstool","frantic","fright","fringe","frivolous","fulfill","garbled","garments","garner","gauntlet","gerbil","giggle","glazed","gloomy","gorgeous","grated","gravel","gravity","greedy","grief","grim","grip","groan","groovy","groping","ground","grudge","gut","hackneyed","haggle","hail","haphazard","harm","harsh","harvest","hassle","hasty","hatch","haunt","haze","heal","hedge","heel","heist","hen","herd","heretic","hermit","hindrance","hindsight","hobbling","hold dear","hollow","hue","hurtle","impart","incessant","incidental","incite","indefatigable","indelible","infraction","inmate","insolvent","intricate","irascible","irresolute","jargon","jeopardy","jiggle","keen","kindle","knack","knob","ladder","lagging","lame","lampoon","languish","lavish","lead","lean","lease","leather","leery","leniency","levity","likely","limb","limp","loaf","loony","loosely","loquacious","lousy","ludicrous","lump","lurches","maize","meander","mend","mere","messy","miff","mild","misanthrope","mischievous","misleading","mock","mold","mole","mood","morose","moss","muck","mug","mull","nave","neat","negligent","nonchalance","obey","obtuse","odorless","offspring","onset","opaque","opulence","orchard","outnumber","outward","overwhelming","parsimonious","partake","paucity","paw","peak","peel","peripheral","peruse","pinch","plea","pledge","poised","popsicle","porch","poultry","pouring","praise","prank","preach","prodigal","profane","progeny","progeny","proximity","prudish","puddle","puffy","pulled","pun","pursuit","put up with","quarrel","querulous","rage","rash","rave","rebuke","recapitulate","recluse","regret","rehearse","rekindle","relieve","rely","remain","renounce","repent","reproach","rescind","resemble","respite","retreat","ribbing","riddle","ridge","rinds","ripe","roaring","roll out","rot","rough","rouse","rug","ruminate","ruse","rust","sagacious","sage","sate","savants","scrawl","screech","screw","scrutinize","seal","seam","seizing","sentient","settle","sew","shackle","shed","shelter","shingles","shiv","shoplift","shore","shriking","shrink","silk","silly","skewer","slash","slaughter","slight","slippers","slope","slug","slum","slump","sly","smear","snail","snap","snore","snub","soaked","sober","somber","soothed","sovereignty","sparkle","spotter","spouting","spree","spurious","squalid","squeeze","squirm","stage","stagnant","stale","stare","stark","steady","steep","stem cell","stickler","sticky","stiff","stingy","stir","stoic","stony","stooped","strain","stretch","stride","stripes","stroll","struck","stubborn","stun","stunt","substantiate","sulky","supplant","surreptitious","swallow","swamp","swath","sway","sweepings","thick","thigh","thorn","thrifty","tickle","tide","torpor","touchy","trite","trousers","trustee","trustworthy","tuckered","turd","udder","unassailable","uncanny","undergo","underneath","uniform","unobstrusive","unpleasant","unscathed","untenable","upbeat","upsetting","vacillate","vanish","veal","vex","vilify","vogue","voluminous","voracious","waist","wart","wax","weave","wedge","weeds","weird","welfare","whalebone","whinning","whipping","wholly","widen","wilted","wipe","wisdom","wise","wool","wool","worthy","wreck","wriggle","writhe"};
// 506 words


int main(void){
   srand(time(NULL));
   game();
   return 0;
}


void game(void){
// Insert source code for Hangman game...
        char *a=voca[rand()%506], alph[100],answer[100]="";
   int len = 0,i = 0,j=0,m=0, n=0, life=7,e=1;  
   len = (strlen(a));

  // scanf("%s",alph);printf("%c",alph[0]);
  
   printf("Guess the word: ");
   for(i=0 ;i < len ; i++)
      printf("_ ");//¸Ç óÀ½ ½ÃÀÛ. ¸ðÁ¶¸® ºóÄ­
   printf("\n");

printf("%s,%d,%c",a,len, a[0]);


  while(life>0 || life==0){
           scanf("%s ",alph);
   if(life>0){
    
         if(strlen(alph)==1){
               if((alph[0]>('A'-1)) || (alph[0]<('Z'+1)))  
                     alph[0]=(alph[0]-'A'+'a');
               else if((alph[0]>('a'-1)) || (alph[0]<('z'+1)))
                     alph[0]=alph[0];
            
                        printf("Guess the word: ");
          
            for(j=0;j<len;j++){
                                        if( a[j]!=alph[0]){
                                                 answer[j]='_';
                                                
                                                 e++;
                                         }
                                         else if(a[j]==alph[0])
                                                  answer[j]=alph[0];
                          

               if(e==len)  {
                                   life--;
                                   drawMan(life);
                           }
                          
                        }
                        printf("%s",answer);
         }
         else if( strlen(alph)==len){
                                for(m=0;m<len;m++){
                                         if((alph[m]>('A'-1)) || (alph[m]<('Z'+1)))  
                                                 alph[m]=(alph[m]-'A'+'a'+1);
                                         else if((alph[m]>('a'-1)) || (alph[m]<('z'+1)))
                                                 alph[m]=alph[m];
                                        
              
                                 }//ÇѱÛÀÚÀÌ»óÀÇ ¹è¿­À» ´Ù ¼Ò¹®ÀÚ·Î ¹Ù²Ù±â

                                if(alph==a){
                                        printf("Congratulations! You guesses my word! ");
                                break;
                                }
                                else{
                                        life--;
                                        drawMan(life);
                                }
        
         }
         else{
            life--;//alph ±æÀÌ°¡ 1°³ ¾Æ´Ï°Å³ª Á¤´äÀ̶û ´Ù¸£¸é ¾µ¸ð°¡ ¾øÁö
            drawMan(life);
                 }
   }
   else if(life==0){
      printf("Game over! The word was %s",a);//life°¡ 0ÀÌ µÇ¸é ³¡³ª´Â°ÅÁö
          break;
        }
   }

}//¹Ýȯ°ªÀÌ ¾øÁö

void drawMan(int life){
   switch(life){
   case 0:
      printf(" O\n/|\\\n |\n/\\\n");
      break;
   case 1:
      printf(" O\n/|\\\n |\n/\n");
      break;
   case 2:
      printf(" O\n/|\\\n |\n");
      break;
   case 3:
      printf(" O\n/|\\\n");
      break;
   case 4:
      printf(" O\n/|\n");
      break;
   case 5:
      printf(" O\n |\n");
      break;
   case 6:
      printf(" O\n");
      break;
   case 7:
      printf("\n");
          break;
   }
}


1.alph¸¦ ÇѱÛÀÚ·Î ÀԷ¹޴°æ¿ì¿¡´Â ´ë¹®ÀÚ·Î ÀԷ½ÿ¡¸¸ ÇÁ·Î±×·¥ÀÌ µ¹¾Æ°¡´Âµ¥ ¼Ò¹®ÀÚ´Â ¿Ö ¾Èµé¾î°¡´Â °É±î¿ä?
2. alph°¡ Á¤´ä a¿Í °°À¸¸é congratulationÀÌ ³ª¿Í¾ß Çϴµ¥ ¿Ö Ʋ¸°°É·Î ÀνÄÇÒ±î¿ä?¤Ð
3. alph¸¦ ÀԷ¹ÞÀ¸¸é _ ´ë½Å¿¡ ±× ¹®ÀÚ°¡ µé¾î°¡¾ß Çϴµ¥, µé¾î°¡±ä µé¾î°¡´Âµ¥ ±× ´ÙÀ½¹ø alph¸¦ »õ·Î ¹ÞÀ»¶§¿¡ ±× Àü ¹®ÀÚµµ °°ÀÌ ÀÔ·ÂµÈ »óŸ¦ ¾î¶»°Ô À¯ÁöÇϳª¿ä?

  Hit : 3146     Date : 2017/12/09 01:42



    
3186     [re] c¾ð¾î ¾Ë°í¸®Áò Áú¹®ÀÔ´Ï´Ù.     dafher
05/13 1578
3185   c¾ð¾î ¼Ò½º Áú¹® ¹¹°¡ ¹®Á¦ÀÎÁö¤Ì¤Ì¤Ì¤Ì[2]     sjjh96
05/23 4264
3184   ÆÄÀ̽ã Ŭ·¡½º °øºÎÁß Áú¹®[1]     wnsdud5534
04/12 3469
3183   dll ÀÎÁ§¼Ç Å°º¸µå ÈÄÅ·(win32api)[1]     healer
03/11 3300
3182   C++ ÇÔ¼ö ¿À¹ö·Îµù ¿À·ù Áú¹®ÀÔ´Ï´Ù. [1]     sweetick
03/04 5503
3181   Æ÷ÀÎÅÍ¿¡ ¸Þ¸ð¸®¸¦ Á÷Á¢ ³Ö´Â°Ô °¡´ÉÇÒ±î¿ä??[3]     ljs0652
01/24 2217
3180   File Descriptor °ü·Ã Áú¹®ÀÔ´Ï´Ù.     tjdalstjr938
01/22 2021
3179   C¾ð¾î [2]     rhdbrkd2
01/02 2657
3178   C¾ð¾î °øºÎ¸¦ ÇÏ·Á°í Çϴµ¥...[3]     rhdbrkd2
12/15 3551
3177   c¾ð¾î ±¸Á¶Ã¼ ¹è¿­ Æ÷ÀÎÅÍ·Î ÇÔ¼ö·Î Àü´ÞÇϴµ¥...[3]     my10045139
12/13 6077
  ÇÙ¸Ç ÄÚµå Áú¹®     yyy3399
12/09 3145
3175   ÀÚ¹Ù ±âÃÊ Ã¥, ¾Û ±âÃÊ Ã¥, ¾Û º¸¾È Ã¥ (3°¡Áö À¯¸íÇÑ Ã¥Á» Ãßõ¹Ù¶ø´Ï´Ù.)[1]     viewstar
11/26 3490
3174   ÀÚ¹Ù ÇÁ·Î±×·¡¹Ö °è»ê±â ÇÁ·Î±×·¥ Áú¹®µå¸³´Ï´Ù.[2]     daze1234
10/27 4499
3173   ÆÄÀ̽ã: ÆĽºÄ®ÀÇ »ï°¢Çü[1]     sunnykim97
10/14 3889
3172   visual studio 2017 c++ ÄÄÆÄÀÏ ¿¡·¯³µ´Âµ¥ ÇØ°á¹æ¹ýÀ» ¸ð¸£°Ú¾î¿ä¤Ð¤Ð     93jmj
10/13 3186
3171   ÇÑ ÇÁ·Î±×·¥ ³» ¼ÒÄÏ 2°³[1]     ysl1121
09/19 3888
3170   C¾ð¾î(¿­Ç÷C) ¿¹Á¦Ç®ÀÌÁß ¾ÈÇ®·Á¼­ Áú¹®µå·Á¿ä ¤Ð¤Ð[5]     ijs2you
08/28 3624
3169   c°øºÎ ½ÃÀÛÇߴµ¥ ¿¹Á¦¸¶´Ù »õ·Î¿î ¼Ò½ºÆÄÀÏ Ãß°¡ÇؾßÇϳª¿ä?[5]     Newbiee
05/10 2980
3168   ÆÄÀ̽ã Äڵ尡 ¹¹°¡¹®Á¦ÀÎÁö ¤Ð¤Ð[1]     zero1
04/29 3317
3167   ÁÖ¾îÁø ¹®Á¦¶û ÄÚµåÀÛ¼ºµÈ°Å¶û ¸Â´ÂÁöºÁÁÖ¼¼¿ä..     lia9173
04/05 2578
[1] 2 [3][4][5][6][7][8][9][10]..[161]

Copyright 1999-2024 Zeroboard / skin by Hackerschool.org / Secure Patch by Hackerschool.org