24 Mart 2010 Çarşamba
UYGULAMA 23 - 19 Mart 2010
PROGRAM FIBONACCI2;
USES CRT, DOS, GRAPH;
VAR gs, gm,i, X1, X2, Y1, Y2, kontrol:INTEGER;
fibonacci: ARRAY[1..100] OF INTEGER;
BEGIN
gs:=DETECT;
INITGRAPH (gs, gm,'C:\TP\BGI');
IF GRAPHRESULT<>GROK THEN HALT(1);
CLEARDEVICE;
fibonacci[1] := 1;
fibonacci[2] := 1;
FOR i := 3 TO 100 DO
BEGIN
fibonacci[i] := fibonacci[i-2] + fibonacci[i-i];
END;
X1 := getmaxx DIV 2; {Baslangic koordinat, farkli bir deger de atanabilir}
Y1 := getmaxy DIV 2;
X2 := X1;
FOR i:=1 TO 100 DO
BEGIN
kontrol := i MOD 4;
CASE kontrol OF
1:
BEGIN
Y2 := Y1 - fibonacci[i];
LINE (X1, Y1, X2, Y2);
Y1 := Y2;
END;
2:
BEGIN
X2 := X1 - fibonacci[i];
LINE (X1, Y1, X2, Y2);
X1 := X2;
END;
3:
BEGIN
Y2 := Y1 + fibonacci[i];
LINE (X1, Y1, X2, Y2);
Y1 := Y2;
END;
0:
BEGIN
X2 := X1 + fibonacci[i];
LINE (X1, Y1, X2, Y2);
X1 := X2;
END;
END;
END;
READLN;
CLOSEGRAPH;
END.
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder