ÇÁ·Î±×·¡¹Ö

 3204, 158/161 ȸ¿ø°¡ÀÔ  ·Î±×ÀΠ 
   hkpco
   [re] // ¹Ø¿¡ ºÐµéÀÌ ´ëÃæ º¸°í ´äº¯ÇÏ½Å°Í °°½À´Ï´Ù.

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


º¸½Ã¸é stdio.h ¸¦ include ¾ÈÇѰ͵µ ¹®Á¦°¡ µË´Ï´Ù.

ÇÏÁö¸¸ gcc ¿¡¼­´Â Àú·±¼Ò½º´Â Å©°Ô ¹®Á¦°¡ µÇÁö ¾Ê½À´Ï´Ù.

int main( void ) { printf( "hi..\n" ); }

ÀÌ ¼Ò½º°¡ ¹®Á¦°¡ µÇÁö ¾Ê´Â°Í 󷳿ä..

±×¸®°í ´Ù¸¥¿¡·¯µµ ¹«¼öÈ÷ ¸¹´øµ¥ stdio.h ÀÎŬ·çµå ¾ÈÇß´Ù°í ÇϽŠ´äº¯Àº Á»..

[ »ý°¢¾øÀÌ ´äº¯ÇÏ½Å°Í °°½À´Ï´Ù.. »ý°¢Á» Çսô٠;) ]

¿¡·¯¸¦ º¸°Ú½À´Ï´Ù. ( Á» ÀÖ±º¿ä -.-; )

1 :int array[10][10];
2 :int num;
3 :void
4 :CircularArray(int n, int direct)
5 :{
6 :if (n==0) return;
7 :for (int i=0; i<2*n-1; i++){
8 :if (i<n)
9 :x += direct;
10:else
11:y += direct
12:array[y][x] = ++num;
13:}
14:CircularArray(n-1, direct*(-1));
15:}
16:main()
17:{
18:printf("¼ýÀÚ¸¦ÀÔ·ÂÇϽÿÀ : ");
19:scanf("%d, &num);
20:CircularArray(num,1);   //¹è¿­Àμâ
21:}  

* gcc ȯ°æ¿¡¼­ test ÇÏ¿´À½.

19 ¶óÀο¡ º¸½Ã¸é scanf("%d, &num); ÀÌ·¸°Ô µÇ¾îÀÖ½À´Ï´Ù.

scanf("%d",&num); À¸·Î °íÃÄÁÖ¼¼¿ä..

±×¸®°í 7 ¶óÀο¡ º¸½Ã¸é for( int i=0 ; i<2*n-1; i++){ ÀÌ·¸°Ô µÇ¾îÀÖ½À´Ï´Ù.

ÃʱⰪÀÌ µé¾î°¡¾ß µÇ´Âµ¥ ¼±¾ð±îÁö ÇØ ¹ö·È½À´Ï´Ù.

2 ¶óÀÎ ´ÙÀ½¿¡ int i; ¸¦ ÇÏ¿©Áֽðí 7 ¶óÀο¡(for¹®)´Â i=0 À¸·Î °íÃÄÁÖ¼¼¿ä.

±×¸®°í x ¿Í y µµ ¼±¾ðÇÏÁö ¾Ê°í »ç¿ëÇϼ̽À´Ï´Ù.

2 ¶óÀÎ ´ÙÀ½¿¡ ¼±¾ðÇϽñ¸¿ä.

11 ¶óÀÎ y += direct ¿¡ ; ¸¦ ³Ö¾î Áֽñ¸¿ä..

-------------------------------------------------------------------------------

¼öÁ¤µÈ ¼Ò½º ÀÔ´Ï´Ù.

int array[10][10];
int num;
int i;
int x=0;
int y=0;

void
CircularArray(int n, int direct)
{
        if (n==0) return;

        for (i=0; i<2*n-1; i++)
        {
        if (i<n)
                x += direct;
        else
                y += direct;

                array[y][x] = ++num;
        }

CircularArray(n-1, direct*(-1));

}

main()
{
        printf("¼ýÀÚ¸¦ÀÔ·ÂÇϽÿÀ : ");
        scanf("%d", &num);
        CircularArray(num,1);   //¹è¿­Àμâ
}

-------------------------------------------------------------------------------

Á¦°¡ int 2Â÷¿ø ¹è¿­À» Àß »ç¿ëÇÏÁö ¾Ê¾Ò°í, ¶Ç Àú ÇÁ·Î±×·¥ÀÌ ¹«½¼ ÀǵµÀÎÁöµµ

¸ô¶ó ±×³É, ÄÄÆÄÀÏ ¿¡·¯¸¸ °íÃƽÀ´Ï´Ù..

»ç¿ë»óÀÇ ¿¡·¯´Â Á» ´õ ³ë·ÂÇϼż­ ¼öÁ¤ÇϽñ⠹ٶø´Ï´Ù..

´Ù½ÃÇѹø ¸»ÇÏÁö¸¸ gcc ȯ°æ¿¡¼­ ÄÄÆÄÀÏ ÇÏ¿´½À´Ï´Ù~

  Hit : 3899     Date : 2003/09/14 10:42



    
64   Áú¹®ÀÌ¿ä~     blue_star
09/14 4696
63     [re] Áú¹®ÀÌ¿ä~[1]     tegi83
05/26 3330
62     ¸Â½À´Ï´Ù.[2]     aiurchar
09/14 4509
61   ~~~ÀÌ°ÍÁ» °¡¸®ÄÑ ÁÖ¼¼¿ä!!~~~ ½ÇÇàÀÌ ¾ÈµÇ¿ä ¤Ð.¤Ì[2]     rhkr8100
09/13 4095
    [re] // ¹Ø¿¡ ºÐµéÀÌ ´ëÃæ º¸°í ´äº¯ÇÏ½Å°Í °°½À´Ï´Ù.     hkpco
09/14 3898
59     [re] ~~~ÀÌ°ÍÁ» °¡¸®ÄÑ ÁÖ¼¼¿ä!!~~~ ½ÇÇàÀÌ ¾ÈµÇ¿ä ¤Ð.¤Ì     ¼ÒÀ¯
09/14 4613
58   ¾È³çÇϼ¼¿ä.C¾ð¾î Áú¹®Àä...[2]     sagelord
09/13 4853
57     [re] ¾È³çÇϼ¼¿ä.C¾ð¾î Áú¹®Àä...     byun1219
05/08 3608
56     [re] ¾È³çÇϼ¼¿ä.C¾ð¾î Áú¹®Àä...[1]     yl
09/13 4420
55     [re] ¾È³çÇϼ¼¿ä.C¾ð¾î Áú¹®Àä...     zipds
09/13 3971
54   ÇØÄð ¸Þ´º¾ó C¾ð¾î Æí.. ÆäÀÌÁö 24ÂÊ °ü·Ã Áú¹®..[1]     jgminam
09/13 4006
53     [re] ÇØÄð ¸Þ´º¾ó C¾ð¾î Æí.. ÆäÀÌÁö 24ÂÊ °ü·Ã Áú¹®..[1]     ¼ÒÀ¯
09/13 4729
52   ¹öÆÛ¿À¹öÇ÷οìÁß Illegal instruction[3]     zipds
09/12 10562
51     [re] ¹öÆÛ¿À¹öÇ÷οìÁß Illegal instruction     kgt2001sus
12/13 4024
50   memset() ÇÔ¼öÁ» ¾ËÄÑÁÖ¼¼¿ë^^[1]     ChRh
09/11 4459
49     [re] memset() ÇÔ¼öÁ» ¾ËÄÑÁÖ¼¼¿ë^^     ¼ÒÀ¯
09/13 6394
48     [re] memset() ÇÔ¼öÁ» ¾ËÄÑÁÖ¼¼¿ë^^     hkpco
09/12 4805
47   ¸®´ª½ºÇÁ·Î±×·¡¹Ö °­Á ½ÎÀÌÆ® ¾Æ½Ã´ÂºÐ??[3]     canrose
09/11 4786
46     [re] ¸®´ª½ºÇÁ·Î±×·¡¹Ö °­Á ½ÎÀÌÆ® ¾Æ½Ã´ÂºÐ??[1]     hkpco
09/11 4152
45   ¾È³çÇϼ¼¿ä~ ¿ÕÃʺ¸ÀÇ Áú¹®ÀÔ´Ï´Ù. @_@;;     bsshq7
09/10 4519
[1]..[151][152][153][154][155][156][157] 158 [159][160]..[161]

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