1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| program calendrier;
uses wincrt;
type
tab=array[0..6] of string;
const
semaine : array[0..6] of string=('Lundi ','Mardi ', 'Mercredi','jeudi ', 'Vendredi', 'Samedi ','Dimanche');
var
cal:tab;
i:byte;
nbj,j,a,m:integer;
s:string;
function IntToStr(i:Integer) : String;
var s : string;
begin
str(i, s);
IntToStr := s;
end;
begin
writeln('saisir le numéro du mois ');
readln(m);
writeln('saisir l''anné ');
readln(a);
writeln('saisir le jour correspandant au premier du mois tels que lundi=0..dimanch=6');
readln(j);
if m in [1,3,5,7,8,10,12] then
begin
nbj:=31;
end
else
if m in [4,6,9,11] then
begin
nbj:=31;
end
else
if m=2 then
if a mod 400=0 then
if a mod 4=0 then
begin
nbj:=29;
end
else
begin
nbj:=28;
end;
for i:= 0 to 6 do
cal[i]:='';
for i:=1 to nbj do
begin
cal[j]:=cal[j]+' '+inttostr(i);
inc(j);
if(j>6) then
j :=0;
end;
for i:= 0 to 6 do
writeln(semaine[i]:5, ' : ',cal[i]:10);
end. |
Partager