Na požiadanie vykreslí kalendár mesiaca usporiadaný podľa týždňov

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Kategórie: KMP (Programy mladých programátorů)

Autor: ghostix
Program: Kalendar.pas
Soubor exe: Kalendar.exe

Na požiadanie vykreslí kalendár mesiaca usporiadaný podľa týždňov. Platný pre rok 2007.
{ KALENDAR.PAS                                Copyright (c) ghostix }
{ Na poziadanie vykresli kalendar mesiaca usporiadany podla tyzdnov }
{ Platny pre rok 2007.                                              }
{                                                                   }
{ Author: Ghostix                                                   }
{ Date  : 18.11.2007                           http://www.trsek.com }
 
program kalendar;
uses crt;
var  z:char;
 
procedure januar;
begin
clrscr;
writeln('----------------------');
writeln('|Po|Ut|St|St|Pi|So|Ne|');
writeln('| 1| 2| 3| 4| 5| 6| 7|');
writeln('| 8| 9|10|11|12|13|14|');
writeln('|15|16|17|18|19|20|21|');
writeln('|22|23|24|25|26|27|28|');
writeln('|29|30|31|  |  |  |  |');
writeln('----------------------');
readln;
end;
 
procedure februar;
begin
clrscr;
writeln('----------------------');
writeln('|Po|Ut|St|St|Pi|So|Ne|');
writeln('|  |  |  | 1| 2| 3| 4|');
writeln('| 5| 6| 7| 8| 9|10|11|');
writeln('|12|13|14|15|16|17|18|');
writeln('|19|20|21|22|23|24|25|');
writeln('|26|27|28|  |  |  |  |');
writeln('----------------------');
readln;
end;
 
procedure marec;
begin
clrscr;
writeln('----------------------');
writeln('|Po|Ut|St|St|Pi|So|Ne|');
writeln('|  |  |  | 1| 2| 3| 4|');
writeln('| 5| 6| 7| 8| 9|10|11|');
writeln('|12|13|14|15|16|17|18|');
writeln('|19|20|21|22|23|24|25|');
writeln('|26|27|28|29|30|31|  |');
writeln('----------------------');
readln;
end;
 
procedure april;
begin
clrscr;
writeln('----------------------');
writeln('|Po|Ut|St|St|Pi|So|Ne|');
writeln('|  |  |  |  |  |  | 1|');
writeln('| 2| 3| 4| 5| 6| 7| 8|');
writeln('| 9|10|11|12|13|14|15|');
writeln('|16|17|18|19|20|21|22|');
writeln('|23|24|25|26|27|28|29|');
writeln('|30|  |  |  |  |  |  |');
writeln('----------------------');
readln;
end;
procedure maj;
begin
clrscr;
writeln('----------------------');
writeln('|Po|Ut|St|St|Pi|So|Ne|');
writeln('|  | 1| 2| 3| 4| 5| 6|');
writeln('| 7| 8| 9|10|11|12|13|');
writeln('|14|15|16|17|18|19|20|');
writeln('|21|22|23|24|25|26|27|');
writeln('|28|29|30|31|  |  |  |');
writeln('----------------------');
readln;
end;
procedure jun;
begin
clrscr;
writeln('----------------------');
writeln('|Po|Ut|St|St|Pi|So|Ne|');
writeln('|  |  |  |  | 1| 2| 3|');
writeln('| 4| 5| 6| 7| 8| 9|10|');
writeln('|11|12|13|14|15|16|17|');
writeln('|18|19|20|21|22|23|24|');
writeln('|25|26|27|28|29|30|  |');
writeln('----------------------');
readln;
end;
procedure jul;
begin
clrscr;
writeln('----------------------');
writeln('|Po|Ut|St|St|Pi|So|Ne|');
writeln('|  |  |  |  |  |  | 1|');
writeln('| 2| 3| 4| 5| 6| 7| 8|');
writeln('| 9|10|11|12|13|14|15|');
writeln('|16|17|18|19|20|21|22|');
writeln('|23|24|25|26|27|28|29|');
writeln('|30|31|  |  |  |  |  |');
writeln('----------------------');
readln;
end;
procedure august;
begin
clrscr;
writeln('----------------------');
writeln('|Po|Ut|St|St|Pi|So|Ne|');
writeln('|  |  | 1| 2| 3| 4| 5|');
writeln('| 6| 7| 8| 9|10|11|12|');
writeln('|13|14|15|16|17|18|19|');
writeln('|20|21|22|23|24|25|26|');
writeln('|27|28|29|30|31|  |  |');
writeln('----------------------');
readln;
end;
procedure september;
begin
clrscr;
writeln('----------------------');
writeln('|Po|Ut|St|St|Pi|So|Ne|');
writeln('|  |  |  |  |  | 1| 2|');
writeln('| 3| 4| 5| 6| 7| 8| 9|');
writeln('|10|11|12|13|14|15|16|');
writeln('|17|18|19|20|21|22|23|');
writeln('|24|25|26|27|28|29|30|');
writeln('----------------------');
readln;
end;
procedure oktober;
begin
clrscr;
writeln('----------------------');
writeln('|Po|Ut|St|St|Pi|So|Ne|');
writeln('| 1| 2| 3| 4| 5| 6| 7|');
writeln('| 8| 9|10|11|12|13|14|');
writeln('|15|16|17|18|19|20|21|');
writeln('|22|23|24|25|26|27|28|');
writeln('|29|30|31|  |  |  |  |');
writeln('----------------------');
readln;
end;
procedure november;
begin
clrscr;
writeln('----------------------');
writeln('|Po|Ut|St|St|Pi|So|Ne|');
writeln('|  |  |  | 1| 2| 3| 4|');
writeln('| 5| 6| 7| 8| 9|10|11|');
writeln('|12|13|14|15|16|17|18|');
writeln('|19|20|21|22|23|24|25|');
writeln('|26|27|28|  |  |  |  |');
writeln('----------------------');
readln;
end;
procedure december;
begin
clrscr;
writeln('----------------------');
writeln('|Po|Ut|St|St|Pi|So|Ne|');
writeln('|  |  |  |  |  | 1| 2|');
writeln('| 3| 4| 5| 6| 7| 8| 9|');
writeln('|10|11|12|13|14|15|16|');
writeln('|17|18|19|20|21|22|23|');
writeln('|24|25|26|27|28|29|30|');
writeln('|31|  |  |  |  |  |  |');
writeln('----------------------');
readln;
end;
 
begin
 repeat;
  writeln('1-januar, 2-februar, 3-marec');
  writeln('4-april, 5-maj, 6-jun');
  writeln('7-jul, 8-august, 9-september');
  writeln('0-oktomber, n-november, d-december');
  writeln('k-konec,');
  z:=readkey;
 
  if z='1' then begin
     januar;
  end;
  if z='2' then begin
     februar;
  end;
  if z='3' then begin
     marec;
  end;
  if z='4' then begin
     april;
  end;
  if z='5' then begin
     maj;
  end;
  if z='6' then begin
     jun;
  end;
  if z='7' then begin
     jul;
  end;
  if z='8' then begin
     august;
  end;
  if z='9' then begin
     september;
  end;
  if z='0' then begin
     oktober;
  end;
  if z='n' then begin
     november;
  end;
  if z='d' then begin
     december;
  end;
 until z='k';
 readln;
end.