ÇÁ·Î±×·¡¹Ö

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

http://www.hackerschool.org/HS_Boards/zboard.php?desc=asc&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 : 4523     Date : 2003/09/09 05:11



    
284   c¾ð¾î ¹¹ºÎÅÍ ÇØ¾ß ÇÒÁö¡¦¡¦.[3]     Ä®¶óÀÏ
10/18 2502
283   µµ¿ÍÁÖ¼¼¿ä c++¿¡¼­,[3]     ĵµéÇÁ·»
04/03 2662
282   µµ¿ÍÁÖ¼¼¿ä c++¿¡¼­,[9]     ĵµéÇÁ·»
04/13 2841
281   Á¤¸» ±âÃÊÀε¥.. Á¦ Áö½ÄÀÌ ´õ ¹Ù´ÚÀ̶ó ..¤Ð¤Ð[9]     Æß¿þ¾î
09/27 2989
280   C¾ð¾î ÀÔ¹®Ã¥À» »ò´Âµ¥¿ä...[5]     ¡ºlastmyself¡»
12/27 3129
279   Å°º¸µå¿¡¼­ ÀÔ·ÂÇÑ ¼ýÀÚ 2¹è¸¸µé±â ÇÔ¼ö Áú¹®;[13]     ¡ºlastmyself¡»
12/27 3138
278   C¾ð¾î¸¦...[1]     ¢ÆÀáµçÆòÈ­¢Æ
04/25 3058
277   C¾ð¾î¹è¿ì´ÂÁßÀε¥..[5]     ¤Ñ.¤Ñ
09/05 5655
  ¹¹°¡ À߸øµÈ°ÇÁö ºÁÁÖ¼¼¿ä     ¤Ñ.¤Ñ
09/09 4522
275   Æ÷ÀÎÅ͸¦ ½±°Ô¼³¸íÇØÁÖ¼¼¿°[6]     ¤Ñ.¤Ñ
09/22 3974
274   Àú±â Àç°¡ À߸𸣴¿ÏÀü Ãʺ¸Àε¥ º¸¿òÁ»,,[2]     ¤Ñ¤Ë¤Ñ
05/10 2745
273   c¾ð¾î ÇÔ¼ö..[4]     °ð¹Ì³²
10/07 3427
272   guest µé¾î¿Ô´Ù°¡.. ±Ã±ÝÁõÀÌ ½ÉÇØÁ®¼­ ¿Ã·Á¿ä..     °ËÀº¿ù¾Æ
11/29 2253
271       [re] [re] ¶Ç Áú¹®Çϳ׿ä.. ±¸Á¶Ã¼ÀÇ Æ÷ÀÎÅÍ¿¡ °üÇÑ Áú¹®ÀÔ´Ï´Ù..[3]     °ËÀº¿ù¾Æ
12/11 2048
270   ¿õ¾Ó °á°úº¸°í ¹«Áö Çò°¥·Á¿¬ ¤Ð¤Ñ¤Ð Áú¹®ÀÔ´Ï´ç '¤Ð'[2]     °ËÀº¿ù¾Æ
02/18 2849
269   ¼Ò½ºÄÚµå ±³Á¤Á»¿ä[2]     °í´¢´¢¸¶½ºÅÍ
04/01 2975
268   ÀÌ°Å Ãƴµ¥ warning ³ª¿À³×¿ä[1]     °í´¢´¢¸¶½ºÅÍ
04/06 3183
267   [±º´ë] ¼¼ ¼öÀÇ ÇÕ[7]     °í¾çÀ̶ËÄ¿ÇÇ
02/10 2383
266     .     °ñµå
05/31 2881
265   .[1]     °ñµå
10/07 2772
[1]..[141][142][143][144][145][146] 147 [148][149][150]..[161]

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