Ñèñòåìíîå ïðîãðàììèðîâàíèå â UNIX ñðåäñòâàìè Free Pascal

       

. Äàòà è âðåìÿ


Óïðàæíåíèå 13.62. Ñîñòàâüòå àíàëîã êîìàíäû date.

ses crt,dos;

var y,h,d,dw,ch,m,s,ms:word;

BEGIN

getdate(y,h,d,dw);

case dw of

  1:write('Ïí');

  2:write('Âò');

  3:write('Ñð');

  4:write('×ò');

  5:write('Ïò');

  6:write('Ñáò');

  7:write('Âñ');



end;

write(' ');

case h of

  1:write('ßíâ');

  2:write('Ôåâ');

  3:write('Ìàð');

  4:write('Àïð');

  5:write('Ìàé');

  6:write('Èþí');

  7:write('Èþë');

  8:write('Àâã');

  9:write('Ñåí');

  10:write('Îêò');

  11:write('Íîÿ');

  12:write('Äåê');

end;

write(' ');

write(d,' ');

gettime(ch,m,s,ms);

write(ch,':',m,':',s,':',ms,' ',y);

readln;

END.

Óïðàæíåíèå 13.63. Ñîñòàâüòå àíàëîã êîìàíäû cal.

uses crt,dos;

procedure cl(year,mes,pol_1:word);

var arr:array [0..7,1..7] of string[2];

    i,j,kdm,n:byte;

    v:boolean;

    kd,k:word;

    s:string[2];

begin

   v:=false;

    for i:=0 to 7 do      

       for j:=1 to 7 do 

        arr[i,j]:='  ';

   if ((year mod 4=0)and(year mod 100<>0))or((year mod 4=0)and(year mod 100=0)and(year mod 400=0))

                                       then v:=true

         else if (year mod 100=0)and(year mod 400<>0)then v:=false;

        

    case mes of

  1:begin writeln('ßíâ');

          kdm:=31;

       kd:=0;

    end;      

  2:begin writeln('Ôåâ');

         kd:=31;

      if v then kdm:=29 else kdm:=28;

    end;               

  3:begin writeln('Ìàð');

          kdm:=31;

       if v then kd:=60 else kd:=59;

    end;     

  4:begin writeln('Àïð');

          kdm:=30;

       if v then kd:=91 else kd:=90;

    end;     

  5:begin writeln('Ìàé');

          kdm:=31;

       if v then kd:=121 else kd:=120;

    end;     

  6:begin writeln('Èþí');

          kdm:=30;

       if v then kd:=152 else kd:=151;

    end;     

  7:begin writeln('Èþë');

          kdm:=31;

       if v then kd:=182 else kd:=181;

    end;     

  8:begin writeln('Àâã');

          kdm:=31;

       if v then kd:=213 else kd:=212;

    end;     



Ñîäåðæàíèå ðàçäåëà