![Forum TIBIA forum Strona Główna Forum TIBIA forum Strona Główna](http://spokogildia.republika.pl/banner.JPG) |
|
Autor |
Wiadomość |
Twoja
Gość
|
Wysłany:
Pon 10:54, 22 Sty 2007 |
![Powrót do góry Powrót do góry](http://picsrv.fora.pl/fiblack/images/icon_up.gif) |
program losoweodcinki;
uses
Crt, Graph;
var
n,i:integer ;
l,suma,max,min,srednia:real;
xp,yp,xk,yk:integer;
Tryb : integer;
Driver : Integer;
begin
writeln('podaj ilosc odcinkow');
readln(n);
randomize;
i:=1;
suma:=0;
max:=0;
min:=getmaxx;
Driver := Detect;
InitGraph(Driver, Tryb, '');
for i:=1 to n do
begin
xp:=random(getmaxx+1);
yp:=random(getmaxy+1);
xk:=random(getmaxx+1);
yk:=random(getmaxy+1);
l:=sqrt((xp-xk)*(xp-xk)+(yp-yk)*(yp-yk));
suma:=suma+l;
if l>300 then
Line(xp,yp,xk,yk);
if l>max then
max:=l;
if l<min then
min:=l;
end;
Repeat until KeyPressed;
CloseGraph;
readln;
writeln('najdluzszy odcinek wynosi ',max:6:1);
writeln('najkrotszy odcinek wynosi ',min:6:1);
srednia:=suma/n;
writeln('sredniadlugosc odcinka wynosi ',srednia:6:1);
readln ;
end.
|
|
|
|
![](http://picsrv.fora.pl/fiblack/images/spacer.gif) |
|
![](http://picsrv.fora.pl/subSilver/images/spacer.gif) |
pan wiesiek
gracz
Dołączył: 08 Mar 2007
Posty: 29
Przeczytał: 0 tematów
Ostrzeżeń: 2/10
|
Wysłany:
Czw 15:22, 08 Mar 2007 |
![Powrót do góry Powrót do góry](http://picsrv.fora.pl/fiblack/images/icon_up.gif) |
fajna masz stara
|
Post został pochwalony 0 razy
|
|
![Zobacz profil autora Zobacz profil autora](http://picsrv.fora.pl/fiblack/images/lang_polish/icon_profile.gif) |
![](http://picsrv.fora.pl/fiblack/images/spacer.gif) |
|
fora.pl - załóż własne forum dyskusyjne za darmo
Powered by phpBB
© 2001/3 phpBB Group :: FI Theme ::
Wszystkie czasy w strefie EET (Europa)
| |