α׷

 3204, 18/161 ȸ  α  
   .
   ߸Ȱ ּ

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



    
2864       .. ذ ȵ˴ϴ.. @_@;;     bsshq7
09/11 4520
  ߸Ȱ ּ     .
09/09 4519
2862   cvsڹ[3]     zloder
04/26 4517
2861   ׿^^;     sagelord
09/23 4513
2860   C Ű Դϴ;; ּ;;[3]     cjhari
10/05 4512
2859   Ұ ?[4]     o-0_o-0
11/29 4511
2858    ׶ α׷ϰ ϴ°Ϳ      yuhioh8
02/25 4505
2857   Ű...˷ּ[2]     dlrlf159
02/27 4505
2856   webhacking.kr Թ..[4]     strikers1999
09/27 4505
2855   ǽù Green guard α׷ ˷ ּ [1]     wqw3
04/16 4501
2854   ¿ [2]     3cushion
09/25 4501
2853     [re] Դϴ.    
09/19 4499
2852   c [3]     Pang
01/26 4497
2851   memset() Լ ּ^^[1]     ChRh
09/11 4495
2850   (ޱ)ͺ c ٿ޾Ҵµ ġ..........     828282jjj
03/21 4489
2849   ƿ~ ϵ      kalbindos
09/14 4489
2848   c c++[2]     jkh0721
04/02 4478
2847   8-2 1][3]     capt_0669
09/07 4478
2846   c ũ c++ c ֽϴ...[10]     superio1999
11/08 4475
2845   ( api)ڵ ڵ鷯?     h@cking2013
10/19 4467
[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