Calculating next date in Turbo Pascal

Posted by Chaima Chaimouta on Stack Overflow See other posts from Stack Overflow or by Chaima Chaimouta
Published on 2010-12-25T13:31:17Z Indexed on 2010/12/25 13:54 UTC
Read the original article Hit count: 327

Filed under:
program date;
uses wincrt;

var
m,ch,ch1,ch2,ch3: string ;
mois,j,a,b: integer ;

begin
write('a');read(a);
write('j');read(j);
write('mois');read(mois);
case mois of
1,3,5,7,8,10: if j<31 then
                          begin
                          b:=j+1;
                          m:=str(b,ch)+'/'+str(mois,ch2)+'/'+str(a,ch3);
                          else  if j=31then
                          b:=1;
                          s:=mois+1;
                          m:=concat(str(b,ch),'/',str(s,ch2),'/',str(a,ch3));
                          end
                          else m:='erreur';    
4,6,9,11:if j<30 then
                 begin
                 b:=j+1;
                 m:=concat(str(b,ch),'/',str(mois,ch2),'/',str(a,ch3));
                 end                         
                 else j=30 then
                 begin
                 b:=1;
                 s:=mois+1;
                 m:=concat(str(b,ch),'/',str(mois,ch2),'/',str(a,ch3));
                 end
                 else m:='erreur';
2:if j<28 then
      begin
      b:=j+1;
      m:=concat(str(b,ch),'/',str(mois,ch2),'/',str(a,ch3));
      end
      else if j=28 then
      begin
      b:=1;
      m:=concat(str(b,ch),'/',str(mois,ch2,'/',str(a,ch3));
      end
      else if((a mod 4=0)AND (a mod 100<>0)) or ((a mod 100=0)and(a mod 400=0)) then
               if j<29 then
               begin
               b:=j+1;
               m:=concat(str(b,ch),'/',str(mois,ch2,'/',str(a,ch3));
               end
               else if j=29 then
               begin
               b:=1;
               m:=concat(str(b,ch),'/',str(mois,ch2,'/',str(a,ch3));
               end
               else m:='erreur';
12:if j<31 then
     begin
     b:=j+1;
     m:=concat(str(b,ch),'/',str(mois,ch2,'/',str(a,ch3));
     end
     else if j=31 then
     begin
     b:=1;
     s:=a+1;
     m:=concat(str(b,ch),'/',str(mois,ch2,'/',str(s,ch3));
     end;       
writeln(m);
end.     

this is my program i hope you be able to help me

© Stack Overflow or respective owner

Related posts about turbo-pascal