program dnipocet (input,output);
uses
crt;
const
mesic:array[1..12] of integer =
(31,29,31,30,31,30,31,31,30,31,30,31);
label
1,2,3,4;
var
rokpoc,mespoc,denpoc,rokkon,meskon,denkon:integer;
pocdnu:real;
r1,r2,r,konec:string;
i:integer;
begin
2: clrscr;
write('Pocatecni rok = ');
readln(rokpoc);
write('Pocatecni mesic = ');
readln(mespoc);
3: write('Pocatecni den = ');
readln(denpoc);
r2:='n';
if rokpoc/4=int(rokpoc/4) then r2:='a';
if rokpoc/100=int(rokpoc/100) then r2:='n';
if rokpoc/400=int(rokpoc/400) then r2:='a';
if ((denpoc=29) and (mespoc=2) and (r2='n')) then
begin
writeln('MŘsˇc m jen 28 dnˇ');
goto 3;
end;
writeln;
write('Konecny rok = ');
readln(rokkon);
write('Konecny mesic = ');
readln(meskon);
4: write('Konecny den = ');
readln(denkon);
r2:='n';
if rokkon/4=int(rokkon/4) then r2:='a';
if rokkon/100=int(rokkon/100) then r2:='n';
if rokkon/400=int(rokkon/400) then r2:='a';
if (denkon=29) and (meskon=2) and (r2='n') then
begin
writeln('MŘsˇc m jen 28 dnˇ');
goto 4;
end;
pocdnu:=0;
if (rokkon=rokpoc) and (mespoc=meskon) then
begin
pocdnu:=pocdnu+(denkon-denpoc+1);
goto 1;
end;
if rokkon=rokpoc then
begin
for i:=mespoc+1 to meskon-1 do
begin
pocdnu:=pocdnu+mesic[i];
if i=2 then
begin
r1:='n';
if rokpoc/4=int(rokpoc/4) then r1:='a';
if rokpoc/100=int(rokpoc/100) then r1:='n';
if rokpoc/400=int(rokpoc/400) then r1:='a';
if r1='n' then pocdnu:=pocdnu-1;
end;
end;
end;
if rokpoc<rokkon then
begin
for i:=mespoc+1 to 12 do
begin
pocdnu:=pocdnu+mesic[i];
if i=2 then
begin
r1:='n';
if rokpoc/4=int(rokpoc/4) then r1:='a';
if rokpoc/100=int(rokpoc/100) then r1:='n';
if rokpoc/400=int(rokpoc/400) then r1:='a';
if r1='n' then pocdnu:=pocdnu-1;
end;
end;
for i:=1 to meskon-1 do
begin
pocdnu:=pocdnu+mesic[i];
if i=2 then
begin
r1:='n';
if rokkon/4=int(rokkon/4) then r1:='a';
if rokkon/100=int(rokkon/100) then r1:='n';
if rokkon/400=int(rokkon/400) then r1:='a';
if r1='n' then pocdnu:=pocdnu-1;
end;
end;
end;
if rokkon-rokpoc>=2 then
begin
for i:=rokpoc+1 to rokkon-1 do
begin
r1:='n';
if i/4=int(i/4) then r1:='a';
if i/100=int(i/100) then r1:='n';
if i/400=int(i/400) then r1:='a';
if r1='n' then pocdnu:=pocdnu+365;
if r1='a' then pocdnu:=pocdnu+366;
end;
end;
pocdnu:=pocdnu+(mesic[mespoc]-denpoc+1);
r1:='n';
if rokpoc/4=int(rokpoc/4) then r1:='a';
if rokpoc/100=int(rokpoc/100) then r1:='n';
if rokpoc/400=int(rokpoc/400) then r1:='a';
if (r1='n') and (mespoc=2) then pocdnu:=pocdnu-1;
pocdnu:=pocdnu+denkon;
1: writeln;
writeln('Pocet dnu = ',pocdnu:18:0);
write('Konec (a/n) ');
readln(konec);
if konec = 'n' then goto 2;
end.
toto je asi ono jen sem moc nepochopil, jak to tam ma s tim rmesic ma 28 dni. Me stačí, když bych to nějak sesmolil jen rokpoc rokkon. taky u toho nechapu ten posledni krok 1 asi by se dal vynechat. jen nevim, jak to jednodušej upravit.
moc mi pomužeš, když se na to mrkneš, ne že bych byl uplny idiot na pascal, ale nějak nechapu matiku

--- Doplnění předchozího příspěvku (Stř Led 05, 2011 7:54 pm) ---
Když odmažu dny a měsice tak mi to už haže error. podle mě ten konec tam byt nemusí. Dny a měsíce taky ne, takže mi vypadne par proměnných no a nemusí tam byt ani ty kroky 1 2 3 a navrat k nim. Pak při měsíci s 28 dny to nechci aby mi to nevypočítalo a napsalo, že ma 28 dni, ale aby mi to prostě i s tim spočítalo
Kdyř z toho dostanu 2 nebo 3 budu štastný člověk

taky mu mužu něco nakecat, že mi to trochu blblo on to opraví a mezi tim zapomene, že to nešlo a da mi dvojku
