ÇÁ·Î±×·¡¹Ö

 3206, 2/161 ȸ¿ø°¡ÀÔ  ·Î±×ÀΠ 
   ¤Ñ.¤Ñ
   ¹¹°¡ À߸øµÈ°ÇÁö ºÁÁÖ¼¼¿ä

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


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);
}

  Hit : 4455     Date : 2003/09/09 05:11



    
3186     [re] Áú¹®ÀÌ¿µ     hkpco
09/08 4129
3185       [re] Áú¹®ÀÌ¿µ[1]     blue_star
09/08 4122
3184   °í¹Î..[4]     chw7379
09/08 3986
3183     [re] °í¹Î..[1]     yl
09/08 4070
3182   ±â´É»çÇÏ°í ±â»çÇÏ°í Â÷ÀÌÁ¡ÀÖ³ª¿µ?[3]     blue_star
09/08 4492
3181     [re] ±â´É»çÇÏ°í ±â»çÇÏ°í Â÷ÀÌÁ¡ÀÖ³ª¿µ? ÀÖÁÒ ^-^;;[1]     Ÿ´Â¸ñ¸¶¸§
09/09 4720
3180     [re] ±â´É»çÇÏ°í ±â»çÇÏ°í Â÷ÀÌÁ¡ÀÖ³ª¿µ?     hw0arang
09/09 4580
3179     [re] °í¹Î..[1]     loveuu
09/09 4187
3178   Áú¹®ÀÌ¿µ~[5]     blue_star
09/09 4263
  ¹¹°¡ À߸øµÈ°ÇÁö ºÁÁÖ¼¼¿ä     ¤Ñ.¤Ñ
09/09 4454
3176     [re] ¹¹°¡ À߸øµÈ°ÇÁö ºÁÁÖ¼¼¿ä[2]     ¼ÒÀ¯
09/09 4607
3175   ¾È³çÇϼ¼¿ä~ ¿ÕÃʺ¸ÀÇ Áú¹®ÀÔ´Ï´Ù. @_@;;     bsshq7
09/10 4518
3174     [re] ¾È³çÇϼ¼¿ä~ ¿ÕÃʺ¸ÀÇ Áú¹®ÀÔ´Ï´Ù. @_@;;     indra
09/11 3925
3173       ¾Ñ.. Á¶±Ý ÀÌÇØ°¡ ¾ÈµË´Ï´Ù.. @_@;;     bsshq7
09/11 4478
3172   ¸®´ª½ºÇÁ·Î±×·¡¹Ö °­Á ½ÎÀÌÆ® ¾Æ½Ã´ÂºÐ??[3]     canrose
09/11 4781
3171     [re] ¸®´ª½ºÇÁ·Î±×·¡¹Ö °­Á ½ÎÀÌÆ® ¾Æ½Ã´ÂºÐ??[1]     hkpco
09/11 4148
3170   memset() ÇÔ¼öÁ» ¾ËÄÑÁÖ¼¼¿ë^^[1]     ChRh
09/11 4457
3169     [re] memset() ÇÔ¼öÁ» ¾ËÄÑÁÖ¼¼¿ë^^     hkpco
09/12 4803
3168     [re] °¨»çÇÕ´Ï´Ù..¸¹Àº µµ¿ò µÆ½À´Ï´Ù..     nanaya
09/12 4078
3167     [re] C¾ð¾î ¸»Àä..^^;     ¼ÒÀ¯
09/12 5925
[1] 2 [3][4][5][6][7][8][9][10]..[161]

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