Q&A

  • 급합니다.
소스 분석이 힘듭니다.

도와주세요...빨리요..

========================================

function Isleapyear(AYear : integer) : Boolean;

begin

Result := (AYear mod 4 = 0) and

((AYear mod 100 <> 0) or (AYear mod 400 = 0 ));

end;

function DaysPerMonth(AYear,Amonth :integer) : integer;

const

DaysInMonth :array[1..12] of integer =

(30,28,31,30,31,30,31,31,30,31,30,31);

var

iLastDate :integer ;

begin

iLastDate :=DaysInMonth[Amonth];

if (AMonth =2) and IsLeapYear(AYear) then inc(iLastDate);

Result := iLastDate ;

end;

기다립니다..

오늘 안에 답을 좀해주십시요..





1  COMMENTS
  • Profile
    2001.07.25 21:23
    님의 소스에 장난칩니다.



    귀염둥이 wrote:

    > 소스 분석이 힘듭니다.

    > 도와주세요...빨리요..

    > ========================================

    년을 받고

    > function Isleapyear(AYear : integer) : Boolean;

    > begin

    > Result := (AYear mod 4 = 0) and

    > ((AYear mod 100 <> 0) or (AYear mod 400 = 0 ));

    4로 나눈 나머지가 0이고 (100으로 나눈 나머지가 0이 아니거나 400으로

    나눈 나머지가 0이면) True가 Result에 들어가고 그렇지 않으면 False가

    Result에 들어갑니다.

    > end;

    년 월 을 받고

    > function DaysPerMonth(AYear,Amonth :integer) : integer;

    > const

    이건 1월부터 12월까지 마지막일을 정의해놓은거구요.

    > DaysInMonth :array[1..12] of integer =

    > (30,28,31,30,31,30,31,31,30,31,30,31);

    > var

    > iLastDate :integer ;

    > begin

    월을 DayslnMonth에 넣어서 월의 마지막 일 값을 iLastDate에 넣고

    > iLastDate :=DaysInMonth[Amonth];

    만약 2월이고 IsLeapYear에 년을 넣어서 만족하면 iLastDate를 1 올립니다.

    > if (AMonth =2) and IsLeapYear(AYear) then inc(iLastDate);

    Result에 iLastDate를 넣지요.

    > Result := iLastDate ;

    > end;

    > 기다립니다..

    > 오늘 안에 답을 좀해주십시요..

    >

    흐흐.. 도움이 되려나..



    ex)

    aaa := DaysPerMonth(2000,2);



    하면

    aaa에 값은 29가 되지요. 아마도.. 흐흐흐



    결국 이것은 2월달을 위한 프로그램이 아닌가 싶네요. 흐흐흐