* Разпознаване на дата

Да се въведе (чрез запис) дата и да се провери и отпечата:

  • дали е валидна дата
  • през кой сезон е
  • дали не е някой важен празник
Публикувано в 10a с етикети . Постоянна връзка.

2 Responses to * Разпознаване на дата

  1. Svetli каза:
    program Project1;
    type Data = record
      D:integer;
      M:integer;
      G:integer;
    end;
    
    var
      A: Data;
    begin
      Writeln('Vavedete den, mesec i godina otdeleni s interval');
      Readln(A.D,A.M,A.G);
      Writeln;
      Writeln('Informaciq za datata:');
    
    
      if ((A.D>=1) and (A.D<=31) and (A.M>=1) and (A.M<=12) and (A.G>=0)) then
         Writeln('Datata e validna')
      else Writeln('Datata ne e validna');
    
      if ((A.M=3) and ((A.D>=20) and (A.D<=31)) or ((A.D>=1) and (A.D<=31) and (A.M>=4) and (A.M<=5)) or (A.M=6) and ((A.D>=1) and (A.D<=20))) then
         Writeln('Sezona e prolet')
      else if ((A.M=6) and ((A.D>=21) and (A.D<=31)) or ((A.D>=1) and (A.D<=31) and (A.M>=7) and (A.M<=8)) or (A.M=9) and ((A.D>=1) and (A.D<=21))) then
         Writeln('Sezona e lqto')
      else if ((A.M=9) and ((A.D>=22) and (A.D<=31)) or ((A.D>=1) and (A.D<=31) and (A.M>=10) and (A.M<=11)) or (A.M=12) and ((A.D>=1) and (A.D<=20))) then
         Writeln('Sezona e esen')
      else if ((A.M=12) and ((A.D>=21) and (A.D<=31)) or ((A.D>=1) and (A.D<=31) and (A.M=1)) or ((A.M=2) and (A.D>=1) and (A.D<=28)) or (A.M=3) and ((A.D>=1) and (A.D<=19))) then
         Writeln('Sezona e zima')
      else if (A.G mod 4 = 0) then
         if ((A.M=2) and (A.D>=1) and (A.D<=29)) then
            Writeln('Sezona e zima')
         else
      else Writeln('Nqma takuv sezon');
    
      if ((A.D = 24) and (A.M = 12)) then Writeln('Praznika e Budni vecher')
      else if ((A.D = 25) and (A.M = 12)) then Writeln('Praznika e Koleda')
      else if ((A.D = 31) and (A.M = 12)) then Writeln('Praznika e Nova Godina')
      else if ((A.D = 6) and (A.M = 12)) then Writeln('Praznika e Nikulden')
      else if ((A.D = 1) and (A.M = 1)) then Writeln('Praznika e Vasilyovden, Nova Godina')
      else if ((A.D = 14) and (A.M = 2)) then Writeln('Praznika e Sveti Valentin, Trifon zarezan')
      else;
    
      Readln;
    end.
    

Вашият коментар