|
||
0
0
[* ºñȸ¿ø *]
Àúµµ °ü½ÉÀÖ¾î¼ Áö¿øÇß¾ú´Âµ¥.. Áö¿øÀÚ°ÝÀÌ ¾ÈµÈ´Ù´Â ¸»¿¡ Å×½ºÆ®¸¦ º¸·¯ °¡Áö´Â ¾Ê¾Ò½À´Ï´Ù. Å×½ºÆ®°¡ ¾î´À Á¤µµÀÎÁö´Â ¸ð¸£°ÚÁö¸¸.. ȸÀå´Ô?ÀÌ ¸éÁ¢À» º»´Ù°í ÇÏ´õ¶ó±¸¿ä. ¸éÁ¢À¸·Î ÀÌ Áö¿øÀÚ°¡ ´Ù¸¥ µ¿±â ±³À°»ý¿¡°Ô µµ¿òÀÌ µÉ ¼ö ÀÖ´Â »ç¶÷ÀÎÁö º»´Ù°í ÇÏ´øµ¥ ÁغñÇÏ½Ç ¶§ Âü°íÇϼ¼¿ä ¹¹.. ÀÌ¹Ì ¾Ë°í ÀÖ´Â ³»¿ëÀÏÁöµµ ¸ð¸£°Ú³×¿ä¤»¤»;
2017-06-09 *
|
0
0
±Í¸°.
2007³âµµ c,c++ Àü¹®°¡ °úÁ¤ ½ÃÇèÄ¥ ´ç½Ã Âü°íÇß´ø ¹®Á¦ ÀÔ´Ï´Ù.
Âü°í·Î ÀÌ Ä¿¸®Å§·³Àº ´ç½Ã¿¡ ±¹ºñÁö¿øÀÌ ¾Æ´Ï¶ó »çºñ·Î ÁøÇàÇϴ°Š°°¾Ò´Âµ¥ Áú¹®ÀÚ´ÔÀÌ ¼ö°ÇÏ·Á´Â °Å¶û ¸Â´ÂÁö´Â À߸𸣰ڽÀ´Ï´Ù. 10³âÀü ÀÚ·á °¨¾È ÇÏ°í Âü°í¸¸ Çϼ¼¿ä. ¹ØÀÇ ¿¹Á¦´Â Àúµµ ½ÃÇè Ä¥ ´ç½Ã ±¸Çؼ ºÃ´ø°Çµ¥ Àúµµ ½ÃÇèÄ¥ ´ç½Ã ¾Ë°í¸®Áò ¹®Á¦ ³ª¿Ô´ø°Å °°´øµ¥¿ä. Âü°í·Î Àú´Â ½ÃÇè °á°ú º¸°í ±× ´ëÇ¥¶õ ºÐÀÌ ÀúÇÑÅ× ÄÄÇ»ÅÍ°Ô¸¦ ¶°³ª¶ó°í Çß¾ú³ª.. ¤»¤»¤»¤» Å»¶ôÇßÁö¸¸ Àü ÄÄÅÍ ¹Ù´Ú¿¡¼ À߸԰í Àß»ì°í ÀÖ½À´Ï´ç ¤¾¤¾ (Àü¹®°¡ ¹®Á¦ 1) ============================================ 1. °á°ú¸¦ ¾²½Ã¿À(10Á¡) x = 0, y = 1, z = 2; printf("%d", --x&&--y||--z); ´ä: 1 printf("%d %d %d", x, y, z); ´ä: -1 0 1 x = 0, y = 1, z = 2; printf("%d", --x||--y&&--z); ´ä: 1 printf("%d %d %d", x, y, z); ´ä: -1 1 2 ============================================ 2. °á°ú¸¦ ¾²½Ã¿À(10Á¡) int sx = -20; unsigned int dx = -20; printf("%d\n", sx >> 2); ´ä: -5; printf("%d\n", dx >> 2); ´ä: 2¿¡ 14½Â-5 ============================================== 3. °á°ú¸¦ ¾²½Ã¿À(10Á¡) float a, b; a = 2.e10 - 1.25; b = a - 2.e10; printf("%d %d", a, b); ============================================= 4. ´ÙÀ½ intÇü ÀÚ·áÀÇ ¾ÐÃàµÈ ÀÚ·á·Î ºÎÅÍ charÇüÀ¸·Î ÃßÃâÇÏ¿© Ãâ·ÂÇÏ°íÀÚ ÇÑ´Ù. 1¹ø°ú 3¹ø¿¡´Â ¹®ÀåÀ» ³Ö°í 2¹ø°ú 4¹ø¿¡´Â °á°ú°ªÀ» ¾²½Ã¿À(10Á¡) unsigned int p = 25300; char a, b; a = ________________; ---> 1 ´ä: p >> 8 printf("%d\n", a); ---> 2 ´ä: 98 b = ________________; ---> 3 ´ä: (char)(p) printf("%d\n", b); ---> 4 ´ä: -44 ============================================= 5. ´ÙÀ½ÀÇ ÀǹÌÇÏ´Â ¹Ù´Â ¹«¾ùÀΰ¡?(10Á¡) (1)char *(*i)[5]; (2)char (*(*i)[])(); ============================================== 6. °á°ú°ªÀ» ¾²½Ã¿À(10Á¡) int x; void main(void) { int x; printf("%d", x++); ´ä: garbage func(); ´ä: x = garbage, y = 0 { int x; printf("%d", x++); ´ä: garbage { extern int x; printf("%d", x++); ´ä: 0 } func(); ´ä: x = garbage, y = 1 printf("%d", x++); ´ä: x = garbage } } void func(void) { int x; static int y; printf("%d", x++); printf("%d", y++); } =============================================== 7. mainÀÇ ¸í·ÉÇà ¸Å°³º¯¼ö¸¦ ÀÌ¿ëÇÏ¿© ´Ü¾î¼ö¸¦ ¾Ë¾Æ³»´Â ÇÔ¼ö¸¦ ¸¸µå½Ã¿À(20Á¡) Ç®ÀÌ) #include #include #define IN 1 #define OUT 0 void main(int argc, char *argv[]) { int word_count = 0, state = OUT; char c; FILE *fp; if (argc > 1) { if ((fp = fopen(argv[1], "r")) == NULL) { printf("%s can't open.\n", argv[1]); exit(1); } while ((c = fgetc(fp)) != EOF) { if (c == ' ' || c == '\n' || c == '\t') state = OUT; else { state = IN; ++word_count; } } printf(" Word number = %d\n", word_count); fclose(fp); } else { printf("Wrong Input...retry!!!\n"); exit(1); } } ================================================================= 8. ÇÑ°³ÀÇ ¹è¿À» ÀÌ¿ëÇÏ¿© ÀÌÁß ½ºÅÃÀ» ±¸ÇöÇÏ°í ÃÖÀûÀÇ »ðÀÔ, »èÁ¦ ¾Ë°í¸®ÁòÀ» ±¸ÇöÇϽÿÀ(20Á¡) Ç®ÀÌ) #include #include #define MEMORY 10 static int stack[MEMORY]; int top1 = 0; int top2 = MEMORY-1; void add(int, int); int deleted(int); void main(void) { int result; add(1, 10); result = deleted(1); printf("½ºÅà 1¿¡¼ »©³½ °ª %d \n", result); add(2, 20); result = deleted(2); printf("½ºÅÃ2 ¿¡¼ »©³½ °ª %d \n", result); } void add(int i, int item) { if (top1 == top2) { printf("stack full\n"); exit(1); } if (i==1) stack[top1++] = item; else stack[top2--] = item; } int deleted(int i) { if (i==1) { if (top1 <= 0) { printf("stack empty\n"); exit(1); } return stack[--top1]; } else { if (top2 >= MEMORY-1) { printf("stack empty\n"); exit(1); } return stack[++top2]; } } |
|
|
¡â ÀÌÀü±Û¡ä ´ÙÀ½±Û | ¸ñ·Ïº¸±â |