ÇÁ·Î±×·¡¹Ö

 3204, 19/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 : 4473     Date : 2003/09/09 05:11



    
2844   ¹¹°¡ À߸øµÈ°É±î¿ä ¤Ð¤Ð[4]     yous4831
02/06 3474
  ¹¹°¡ À߸øµÈ°ÇÁö ºÁÁÖ¼¼¿ä     ¤Ñ.¤Ñ
09/09 4472
2842   ¹¹°¡ À߸ø 됬´ÂÁö Àß ¸ð¸£°Ú¾î¿ä ¤Ð,.¤Ì[1]     ÁÖÈ£
02/26 2872
2841   ¹°¾îº¸°í ½ÍÀº°ÍÀÌ ÀÖ½À´Ï´Ù.. ´äº¯Á» ºÎŹµå¸²..!![2]     virus6
03/17 2422
2840   ¹°¸®¿Í ¼öÇÐÁß ´õ Áß¿äÇÑ °ú¸ñ??[7]     kumi123
09/12 2980
2839   ¹°¸®µð½ºÅ© Á¢±ÙÇÏ´Â ÄÚµå ÀÛ¼ºÁßÀä..[2]     kmc8724
08/28 4406
2838   ¹®¼­¾ÏÈ£ Ǫ´Â¹ý??[1]     laclarte
01/16 7434
2837   ¹®¹ý ¿À·ù°¡ ³ª´Âµ¥ ¾î¶² ¿À·ùÀÎÁö ¸ð¸£°Ú³×¿ä[4]     tlsdbcjs
03/25 3070
2836   ¹®Á¦ÀÇ c¾ð¾î ÄÚµå..(ÇÔ¼ö °ü·Ã)[1]     cjswo1234
11/01 3407
2835   ¹®Á¦ °Ë»ç ÇØÁÖ¼¼¿ä ¤Ð[5]     benkim
06/09 5114
2834   ¹®ÀÚ¿­¿¡¼­ ++¿¬»ê[2]     gusiri
01/21 2514
2833   ¹®ÀÚ¿­¿¡ ´ëÇÑ ¿©·¯°¡Áö Áú¹®     isvan812
02/02 3096
2832   ¹®ÀÚ¿­°ú ¹è¿­¸í(Æ÷ÀÎÅÍ»ó¼ö) ¤Ì¤Ì Áú¹®...[3]     ¿¬½À»ý
08/28 3739
2831   ¹®ÀÚ¿­À» »ç¿ëÇÑ if ¹®[3]     nsh009
03/13 9753
2830   ¹®ÀÚ¿­À» ´Ù¸¥ ¹®ÀÚ¿­·Î ¹Ù²Ù´Â¹ýÁ».....ÇÏ¤Ì [3]     ±×´Ï
10/23 3546
2829   ¹®ÀÚ¿­Àº ¾Æ½ºÅ°ÄÚµå·Î ¾î¶»°Ô °¡³ª¿ä?[2]     kangms0801
10/14 3665
2828   ¹®ÀÚ¿­ÀÌ ¹¹ÁÒ?[2]     k1475369
10/21 2476
2827   ¹®ÀÚ¿­ ¹è¿­»ç¿ëÇؼ­ µ¡¼ÀÇϴ°ŠÀß ¸ð¸£°Ú¾î¿ä[1]     ÃÊ¿ìÃÊ¿ì
12/04 7506
2826   ¹®ÀÚ¿­ °ü·Ã 2Â÷¿ø Æ÷ÀÎÅ͹迭¿¡¼­ Áú¹®µå¸³´Ï´Ù![3]     teamo1111
05/03 2775
2825   ¹®ÀÚ¿­ ó¸®ÇÏ´Â °Í¿¡ ´ëÇØ Áú¹®ÀÌ ÀÖ¾î¿ä     yyjg
11/10 4078
[1]..[11][12][13][14][15][16][17][18] 19 [20]..[161]

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