ÇÁ·Î±×·¡¹Ö

 3206, 7/161 ȸ¿ø°¡ÀÔ  ·Î±×ÀΠ 
   ¼ÒÀ¯
   http://soyu.cafe2.net
   [re] ¹¹°¡ À߸øµÈ°ÇÁö ºÁÁÖ¼¼¿ä

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


>visual c++¿¡¼­ Çߴµ¥ ¿À·ù 14°³Á¤µµ ¤Ñ.¤Ñ
>
>#include <stdio.h>
>
>#define MAX 100
>#define YES 1
>#define NO 0
>
>long income[MAX];
>int month[MAX],day[MAX],year[MAX];
>int x,y,ctr;
>int cont;
>long month_total, grand_total;
>void main(void);
>int display_instructions(void);
>void get_data(void);
>void display_report(void);
>int continue_function(void);
>
>
>
>void main(void)
>{
>        cont=display_instructions();
>        if(cont==yes)
>        {
>                get_data();
>                display_report();
>        }
>        else
>                printf("\nProgram aborted by user!\n\n");
>}
>
>
>
>
>int display_instructions(void)
>{
>        printf("\n\n");
>        printf("nThis program enables you to enter up to 99 peple\'s");
>        printf("\nincomes and birthdays. It then prints the incomes by");
>        printf("\nmonth along with the overall income and overall average.");
>        printf("\n");
>        cont= continue_function();
>        return (cont);
>}
>
>void get_data(void)
>{
>        for(cont=YES,ctr=0;ctr<MAX && cont==YES; ctr++)
>        {
>                printf("\nEnter information for Person %d", ctr+1);
>                printf("\n\tEnter Birthday: ");
>
>                do
>                {
>                        printf(\n\tMonth (0 - 12) : ");
>                        scanf("%d", &month[ctr]);
>                }while (month[ctr} < 0 || month[ctr] > 12);
>                
>                do
>                {
>                        printf("\n\tDay (0 - 31): ");
>                        scanf("%d", &day[ctr]);
>                }while (day[ctr] < 0 || month[ctr] > 31);
>                
>                do
>                {
>                        printf("\n\tYear (0 - 1997): ");
>                        scanf("%d", &year[ctr]);
>                }
>                while (year[ctr] < 0 || year[ctr] > 1997);
>
>                printf("\nEnter Yearly Income (whole dollars): ");
>                scanf("%ld", &income[ctr]);
>                
>                cont = continue_function();
>        }
>}
>
>void display_report()
>{
>        grand_total=0;
>        printf("\n\n\n");
>        printf("\n                SALARY SUMMARY");
>        printf("\n                ===============");
>
>        for(x=0; x<=12; x++)  
>        {
>                month_total=0;
>                for(y=0; y<ctr; y++)
>                {
>                        if(month[y]==x)
>                                month_total+=income[y];
>                }
>                printf("\nTotal for month %d is %ld", x, month_total);
>                grand_total+=month_total;
>        }
>        printf("\nReport totals: ");
>        printf("\nToTal Income is %ld", grand_total);
>        printf("\nAverage Income is %ld", grand_total/ctr);
>
>        printf("\n\n* * * End of Report * * *\n");
>}
>
>int continue_function(void)
>{
>        printf("\n\nDo You Wish to continue? (0=NO/1=YES): ");
>        scanf("%d", &x);
>
>        while(x<0 || x>1)
>        {
>                printf(\n%d is invalid!",x);
>                printf(\nPlease enter 0 to quit or 1 to continue: ");
>                scanf("%d",&x);
>        }
>        if(x==0)
>                return(NO);
>        else
>                return(YES);
>}
>


        while(x<0 || x>1)
       {
                printf(\n%d is invalid!",x);
                printf(\nPlease enter 0 to quit or 1 to continue: ");
              scanf("%d",&x);
      }

À§¿¡¼­ ½Öµû¿ÈÇ¥ ºüÁ³À½...

  Hit : 4603     Date : 2003/09/09 09:26



    
yl Àú·±°Å¶§¸Þ ¿¡·¯³ª¸é Á¤¸» °ñÄ¡¾ÆÇÅ´Ï´Ù ¤»¤» 2003/09/10  
pinix1234 Â÷±ÙÂ÷±Ù ¿¡·¯ÇØ°áÇÏ½Ã¸é µÇ¿ä ¤¾¤¾¤¾¤¾ Èû³»»ï ¤¾¤¾ 2010/04/28  
3086     [re] memset() ÇÔ¼öÁ» ¾ËÄÑÁÖ¼¼¿ë^^     ¼ÒÀ¯
09/13 6385
3085     [re] ±â´É»çÇÏ°í ±â»çÇÏ°í Â÷ÀÌÁ¡ÀÖ³ª¿µ?     ¼ÒÀ¯
09/13 4983
3084     [re] °í¹Î..     ¼ÒÀ¯
09/13 4105
3083     [re] Áú¹®ÀÌ¿µ     ¼ÒÀ¯
09/13 4671
3082     [re] ÆäÀÌÁö ·Îµù½Ã Áñ°Üã±â ÀÚµ¿À¸·Î Ãß°¡µÇ±âÁ» °¡¸£ÃÄ ÁÖ¼¼¿ä     ¼ÒÀ¯
09/13 5797
    [re] ¹¹°¡ À߸øµÈ°ÇÁö ºÁÁÖ¼¼¿ä[2]     ¼ÒÀ¯
09/09 4602
3080     [re] C¾ð¾î ¸»Àä..^^;     ¼ÒÀ¯
09/12 5921
3079     [re] ¸®´ª½º     ¼ÎÀÌ
08/15 2607
3078   ¸®´ª½º[1]     ¼ÎÀÌ
08/15 2709
3077   ½ºÅ¸Å©·¡ÇÁÆ® ¹èƲ³Ý Áú¹®ÀÔ´Ï´Ù..[1]     ¼ðÄ«¿¤
03/21 3551
3076     [re] C¾ð¾î °øºÎÇϸ鼭 ±Ã±ÝÇß´ø°Íµé ´äº¯Á» ºÎŹµå¸³´Ï´Ù/[1]     »þ¸£
11/06 2776
3075     [re] ÀڷᱸÁ¶¿¡¼­ Èñ¼ÒÇà·Ä¿¡ ´ëÇؼ­ ¼³¸íÇØÁֽǺÐ...ºÎŹµå¸®°Ú½À´Ï´Ù     »þ¸£
10/25 9388
3074     [re] ¿À´ÃÀº Áú¹®ÀÌ Á» ¸¹³×¿ä^^;[1]     »þ¸£
09/23 4085
3073   ÇÏ C++µµ¿òÀÌ ÇÊ¿äÇØ¿ä °í¼öºÐµé ¤Ð¤Ð     »óÂÞ´Ï
03/24 2949
3072   [C#]°´Ã¼¸¦ »ç¿ëÇÒ ¶§ °´Ã¼¸íÀ» Á¶ÇÕÇؼ­ »ç¿ë ÇÒ ¼ö´Â ¾øÀ»±î¿ä?[1]     »çºó
11/06 2756
3071   c¾ð¾î Ã¥À» ±¸ÀÔÇÏ·Á°í Çϴµ¥¿ä.[1]     º¸·Î¹Ì¿À
06/24 3537
3070   ÇØÅ·À» ÇÏ·Á¸é ÇÁ·Î±×·¡¹Ö¾ð¾î[7]     º¸¶ó»ö
10/05 3168
3069   Á¦°¡ C°¡ º¸ÀÌ´Â ±×¸²Ã¥ »ò´Âµ¥¿ä,,.,.,[6]     º¯Áø¿ë
12/13 4106
3068   ¼Ò½º°øºÎ¸¦ ÇÏ°í ½ÍÀºµ¥...[13]     ºÒ¾ÈÇØ..
05/07 3678
3067   ÆÄÀÏ ÀÔÃâ·Â¿¡ °üÇؼ­...     ºí·º³²ÀÚ
11/20 2643
[1][2][3][4][5][6] 7 [8][9][10]..[161]

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