Checl by som sa spytat (poprosit), ci sa tu najde niekto ochotny, kto by mi navrhol program v Pascale, ktory potrebujem do skoly ako seminarnu pracu. Zadanie znie:
Zostavte algoritmus a program, ktorý zistí podľa dátumu narodenia akého je znamenia daná osoba a koľko dní ubehlo od jej narodenia po súčasnosť.
Zadanie vypracujte nasledovne:
1. Vykonajte analýzu všetkých potrebných vstupných a výstupných premenných. Stanovte ich dátový typ.
2. Zostavte štruktogram.
3. Zostrojte program v Pascale.
Body 1 a 2 si uz snad potom dam dokopy aj sam.
Vopred dakujem.
Pomoc s programom v Pascale - seminarna praca
-
feromakovi
Expert
- Príspevky: 165
- Registrovaný: 24 okt 2008, 14:16
- Bydlisko: Bánovce nad Bebravou
pascal
no ahoj tak program som spravil pozri si to coi sa ti to lubi alebo nie. ak niecomu nebudes rozumiet tak daj vedet a vysvetlim ti to. inak ten konecny pocet dni kolko zijem je vcitane toho dna v ktorom som sa narodil ak by si ten den narodenia nechcel zapocitat staci dat na koniec programu tesne pred vypisom pocet:=pocet-1;
inak je tam na moj vkus velmi vela podmienok. ten pocet dni vypocitalo presne na troch datumoch co som skusal, dalej som to opodmienkoval este ak je rok narodenia zhodny s dnesnym rokom.
dnesom za zisti z biosu cez proceduru.
no nic pozri si vyskusaj a uvidis:
u mna fungoval fajnovo ak chces nejaku lepsiugrafiku pre ten program tak hadam to zvladnes ak nie tak este sa ti s tym pohram ak budes chcet.

inak je tam na moj vkus velmi vela podmienok. ten pocet dni vypocitalo presne na troch datumoch co som skusal, dalej som to opodmienkoval este ak je rok narodenia zhodny s dnesnym rokom.
dnesom za zisti z biosu cez proceduru.
no nic pozri si vyskusaj a uvidis:
Kód: Vybrať všetko
program seminar;
uses crt,dos;
var narodenik,strih:string;
i,den,rok,mesiac,code,od:integer;
y,m,d,dow:word;
pocet:longint;
pole:array [1..12] of integer;
begin
clrscr;
getdate(y,m,d,dow);
write('Zadaj tvoj datum narodenia v tvare "dd.mm.rrrr": ');
readln(narodenik);
strih:=copy(narodenik,1,2);
val(strih,den,code);
strih:=copy(narodenik,4,2);
val(strih,mesiac,code);
strih:=copy(narodenik,7,4);
val(strih,rok,code);
pocet:=0;
if y>rok then begin
if y-rok>=2 then begin
for i:=rok+1 to y-1 do begin
if (i-1900)mod(4)=0 then pocet:=pocet+366
else if (i-1900)mod(4)<>0 then pocet:=pocet+365;
end;
end;
od:=0;
if mesiac=1 then od:=den-1;
if mesiac=2 then od:=31+den-1;
if mesiac=3 then od:=31+29+den-1;
if mesiac=4 then od:=31+29+31+den-1;
if mesiac=5 then od:=31+29+31+30+den-1;
if mesiac=6 then od:=31+29+31+30+31+den-1;
if mesiac=7 then od:=31+29+31+30+31+30+den-1;
if mesiac=8 then od:=31+29+31+30+31+30+31+den-1;
if mesiac=9 then od:=31+29+31+30+31+30+31+31+den-1;
if mesiac=10 then od:=31+29+31+30+31+30+31+31+30+den-1;
if mesiac=11 then od:=31+29+31+30+31+30+31+31+30+31+den-1;
if mesiac=12 then od:=31+29+31+30+31+30+31+31+30+31+30+den-1;
if ((rok-1900)mod(4)<>0)and(mesiac>=3) then od:=od-1;
if (rok-1900)mod(4)=0 then pocet:=pocet+(366-od);
if (rok-1900)mod(4)<>0 then pocet:=pocet+(365-od);
if m=1 then pocet:=pocet+d;
if m=2 then pocet:=31+d+pocet;
if m=3 then pocet:=31+29+d+pocet;
if m=4 then pocet:=31+29+31+d+pocet;
if m=5 then pocet:=31+29+31+30+d+pocet;
if m=6 then pocet:=31+29+31+30+31+d+pocet;
if m=7 then pocet:=31+29+31+30+31+30+d+pocet;
if m=8 then pocet:=31+29+31+30+31+30+31+d+pocet;
if m=9 then pocet:=31+29+31+30+31+30+31+31+d+pocet;
if m=10 then pocet:=31+29+31+30+31+30+31+31+30+d+pocet;
if m=11 then pocet:=31+29+31+30+31+30+31+31+30+31+d+pocet;
if m=12 then pocet:=31+29+31+30+31+30+31+31+30+31+30+d+pocet;
if (y-1900)mod(4)<>0 then pocet:=pocet-1;
writeln;
write('Dnes zijes uz ',pocet,' dni.');
end
else if (y=rok)and(mesiac=m)and(den<=d) then begin
pocet:=d-den+1;
write('Dnes zijes uz ',pocet);
if pocet=1 then write(' den.')
else if pocet>1 then write(' dni.');
end
else if ((y=rok)and(mesiac<m)) then begin
pole[1]:=31;
if (y-1900)mod(4)=0 then pole[2]:=29
else pole[2]:=28;
pole[3]:=31;pole[4]:=30;pole[5]:=31;pole[6]:=30;pole[7]:=31;pole[8]:=31;
pole[9]:=30;pole[10]:=31;pole[11]:=30;pole[12]:=31;
if m-mesiac>=2 then for i:=mesiac+1 to m-1 do pocet:=pocet+pole[i];
od:=pole[mesiac]-den+1;
pocet:=pocet+od+d;
write('Dnes zijes uz ',pocet,' dni.');
end
else write('Nemozes sa narodit v buducnosti!');
writeln;
write('Znamenim si ');
if ((den>=21)and(mesiac=3))or((den<=20)and(mesiac=4)) then write('baran');
if ((den>=21)and(mesiac=4))or((den<=20)and(mesiac=5)) then write('byk');
if ((den>=21)and(mesiac=5))or((den<=21)and(mesiac=6)) then write('blizenec');
if ((den>=22)and(mesiac=6))or((den<=22)and(mesiac=7)) then write('rak');
if ((den>=23)and(mesiac=7))or((den<=23)and(mesiac=8)) then write('lev');
if ((den>=24)and(mesiac=8))or((den<=23)and(mesiac=9)) then write('panna');
if ((den>=24)and(mesiac=9))or((den<=23)and(mesiac=10)) then write('vahy');
if ((den>=24)and(mesiac=10))or((den<=22)and(mesiac=11)) then write('skorpion');
if ((den>=23)and(mesiac=11))or((den<=21)and(mesiac=12)) then write('strelec');
if ((den>=21)and(mesiac=1))or((den<=20)and(mesiac=2)) then write('vodnar');
if ((den>=21)and(mesiac=2))or((den<=20)and(mesiac=3)) then write('ryby');
if ((den>=22)and(mesiac=12))or((den<=20)and(mesiac=1)) then write('kozorozec');
write('.');
readln;
end.u mna fungoval fajnovo ak chces nejaku lepsiugrafiku pre ten program tak hadam to zvladnes ak nie tak este sa ti s tym pohram ak budes chcet.
Velmi pekne dakujem, je to super (este som to sice neodskusal, len podla precitania), ja som to skusal pisat tiez, ale mal som to omnoho zlozitejsie
. K tomuto tvojmu len doplnim komentare a bude to faj
. S analyzou premennych a struktogramom si uz poradim. Grafiku dorabat netreba.
Este raz DAKUJEM.
Este raz DAKUJEM.