±¤°í, ¿å¼³, µµ¹è±ÛÀº ±ÝÁöÀ̸ç, ÷ºÎÆÄÀÏ #1 : ±×¸²¸¸, ÷ºÎÆÄÀÏ #2 : ÀÏ¹Ý ÆÄÀϵµ ¿Ã¶ó°©´Ï´Ù. ¿ë·® Á¦ÇÑÀº 10MBÀÔ´Ï´Ù.


  the Manster(2005-11-21 04:01:02, Hit : 1090, Vote : 149
 http://manster.nasol.net
 gamehw.zip (23.8 KB), Download : 74
 °øÇÐ ÀüÀÚ °è»ê ¼÷Á¦ #2 (¼öÁ¤)

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <conio.h>

void total(int j, int wins)
{
        if(wins==1) printf("%5d   ½Â   ",j);
        else if(wins==0) printf("%5d   ÆР  ",j);

        if(j%6==0) printf("\n");
        if(j%300==0) {
                printf("¿£ÅÍÅ°¸¦ ´©¸£½Ã¸é ³Ñ¾î°©´Ï´Ù");
                getch();
                printf("\n");
        }
}

void main()
{
        int num,i,win,cnt,cnts=0,x=1,y=1,choice,car,my; // º¯¼ö ¼±¾ð ÁöÁ¡ °íÁ¤ ºÒº¯

        long seed;
        seed=time(NULL);
        srand(seed);
        printf("¿©·¯ºÐ ¾Õ¿¡´Â 3°³ÀÇ ¹®ÀÌ ÀÖ½À´Ï´Ù. ÀÌ Áß ÇϳªÀÇ ¹® µÚ¿¡´Â Â÷°¡\n"); // °¡±ÞÀû ¿©·¯ÁÙ·Î ÇÏ´Â °ÍÀÌ ÁÁÀ½
        printf("ÇÑ´ë ÀÖ°í ³ª¸ÓÁö µÎ °³ÀÇ ¹® µÚ¿¡´Â ¿°¼Ò°¡ ÇѸ¶¸®¾¿ ÀÖ½À´Ï´Ù. ¿©\n"); // ÇÑÁÙ·Î ÇÏ¸é ±ÛÀÚ¼ö Á¦ÇÑ¿¡ °É¸²
        printf("·¯ºÐÀÌ ÇϳªÀÇ ¹®À» ¼±ÅÃÇÑ ÈÄ, ÄÄÇ»ÅÍ´Â ³ª¸ÓÁö µÎ °³ÀÇ ¹® Áß ¿°\n");
        printf("¼Ò°¡ ÀÖ´Â ¹®À» ¿­¾î º¸¿© ÁÝ´Ï´Ù. ÀÌ ¶§ ¿©·¯ºÐÀº ´ÙÀ½ 3°¡Áö Àü·«\n");
        printf("Áß ¾î¶² Àü·«À» ¼±ÅÃÇϽðڽÀ´Ï±î?\n");
        printf("\t1. óÀ½ ¼±ÅÃÇÑ ¹®À» ±×´ë·Î À¯Áö\n");
        printf("\t2. À¯Áö ȤÀº º¯°æÀ» ¹«ÀÛÀ§·Î °áÁ¤ (µ¿Àü ´øÁö±â µîÀÇ ¹æ¹ýÀ¸·Î)\n");
        printf("\t3. ¼±ÅõÇÁö ¾Ê°í ¿­¸®Áö ¾ÊÀº ¹®À¸·Î º¯°æ\n");
        while(x)
        {
                printf("¼±ÅÃÇϽŠÀü·« ¹øÈ£¸¦ ÀÔ·ÂÇϽʽÿÀ (1~3) : ");
                scanf("%d",&num);
                if(num>=4||num<=0) {
                        printf("1,2,3Áß ÇÑ°¡Áö °ªÀ» ÀÔ·ÂÇϽʽÿÀ\n");
                        x=1;
                }
                else x=0;
        }
        while(y)
        {
                printf("°ÔÀÓÀÇ ÁøÇà ȸ¼ö¸¦ ÀÔ·ÂÇϽʽÿÀ (10~10000): ");
                scanf("%d",&cnt);
                if(cnt>=10001||cnt<=9) {
                        printf("10~10000 »çÀÌÀÇ °ªÀ» ÀÔ·ÂÇϽʽÿÀ\n");
                        y=1;
                }
                else y=0;
        }
        printf("   ȸ  °á°ú     ȸ  °á°ú     ȸ  °á°ú     ȸ  °á°ú     ȸ  °á°ú     ȸ  °á°ú\n");
        printf("==============================================================================\n");

        if(num==1) //³ªÀÇ ¼±ÅÃÀ» À¯ÁöÇÏ´Â °æ¿ì
        {
                for(i=1;i<=cnt;i++)
                {
                        car=(rand()%3)+1;
                        my=(rand()%3)+1;
                        if(car==my)
                        {
                                win=1;
                                cnts+=1;
                        }
                        else
                                win=0;
                        total(i,win);
                }
        }
        else if(num==2) // µ¿Àü´øÁö±â °°Àº ¹æ¹ýÀ» ÀÌ¿ëÇÏ¿© À¯Áö ȤÀº º¯°æÀ» °áÁ¤
        {
                for(i=1;i<=cnt;i++)
                {
                        car=(rand()%3)+1;
                        my=(rand()%3)+1;
                        choice=rand()%2;   // ¼±ÅÃ
                        if(choice==0)  // À¯Áö·Î °áÁ¤
                        {
                                if(car==my)
                                {
                                        win=1;
                                        cnts+=1;
                                }
                                else
                                        win=0;
                        }
                        else if(choice==1) // º¯°æÀ¸·Î °áÁ¤
                        {
                                if(car!=my)
                                {
                                        win=1;
                                        cnts+=1;
                                }
                                else
                                        win=0;
                        }
                        total(i,win);
                }


        }
        else if(num==3)
        {
                for(i=1;i<=cnt;i++)
                {
                        car=(rand()%3)+1;
                        my=(rand()%3)+1;
                        if(car!=my)
                        {
                                win=1;
                                cnts+=1;
                        }
                        else
                                win=0;
                        total(i,win);
                }
        }

        printf("\nÂü°¡ÀÚ°¡ ¼±ÅÃÇÑ Àü·« : %d. ",num);
        switch(num) {
                case 1 : printf("óÀ½ ¼±ÅÃÇÑ ¹®À» ±×´ë·Î À¯Áö\n"); break;
                case 2 : printf("À¯Áö ȤÀº º¯°æÀ» ¹«ÀÛÀ§·Î °áÁ¤\n"); break;
                default : printf("¼±ÅõÇÁö ¾Ê°í ¿­¸®Áö ¾ÊÀº ¹®À¸·Î º¯°æ\n"); break;
        }
        printf("Âü°¡ÀÚ°¡ ÀÌ±ä °ÔÀÓ ¼ö : %dȸ / %dȸ\n",cnts,cnt);
        printf("½Â·ü : %5.3f%% ",100*(float)(cnts)/(float)(cnt));
        getch();
}

Àç¼öÁ¤ÇßÀ½...´Ùµé ¾Ë¾Æ¼­ °¢ÀÚ ÀûÀýÈ÷ ¼öÁ¤Çؼ­ ¾µ ¼ö ÀÖµµ·Ï ÇϽÿÀ;;;



the Manster (2005-11-21 04:01:31)  
±×¸®°í °¡±ÞÀûÀ̸é À§¿¡ ±Û·Î ¿Ã¶ó°£°Å ¸»°í ¼Ò½ºÄÚµå ÆÄÀÏ ¹Þ¾Æ¼­ ¾²´Â °Ô ÁÁÀ½;;;
the Manster (2005-11-21 18:09:15)  
getch(); ¸¦ getchar(); ·Î ¹Ù²Ù´Â °æ¿ì óÀ½ ÇѹøÀº ±×³É Áö³ª°¡¹ö¸®´Â ¹ö±×·Î ÀÎÇØ ±×³É »ç¿ë ÇßÀ½.


40   6Àü´Ü¶§ »çÁø....  the Manster 2005/06/26 1052 206
39   °ú°Å¿Í ÇöÀç [1]  the Manster 2005/06/26 1043 225
38   ÈÞ°¡ ³ª¿Â Àü°æ;;;  the Manster 2005/07/10 1158 215
37   ¿ì¸®Áý  the Manster 2005/07/10 1094 205
36   ½ÃÇè Àü³¯ ÁõÈıº  the Manster 2005/07/28 1026 238
35   Çõ¿ CÁ¶ 1ȸ ½Ç½À °á°ú¹°  the Manster 2005/09/21 906 145
34   °øÇÐ ÀüÀÚ °è»ê ¼÷Á¦ #1 [1]  the Manster 2005/10/07 1138 198
33   Ç± ¤»¤» [1]  ³ëÇü¹Î 2005/11/09 1002 214
  °øÇÐ ÀüÀÚ °è»ê ¼÷Á¦ #2 (¼öÁ¤) [2]  the Manster 2005/11/21 1090 149
31   Çü´Ô ¤»¤» [1]  ³ëÇü¹Î 2005/11/25 995 215
30   Àü»êÀÀ¿ë.....  the Manster 2005/11/28 859 183
29   Çü´Ô Àúµµ Çغýɴõ. ÇÔ º¸ÀÌ¼Ò [2]  ³ëÇü¹Î 2005/11/28 919 191
28   ¿À´Ã ÀÚ¹Ù ½ºÅ͵ð·Î § ÇÁ·Î±×·¥;;;  the Manster 2005/11/30 874 179
27   ÇÁ·ÎÁ§Æ®.....´ë·« ÁÂÀý;;; [2]  the Manster 2005/12/03 943 171

[1][2][3][4][5][6][7][8][9] 10 [11][12]
 

Copyright 1999-2024 Zeroboard / skin by zero