Love What You Do, Do What You Love

Program Mencari Akar Hampiran dengan Metode Bagi Dua Menggunakan Delphi 7

Posted by : Unknown
Selasa, 26 November 2013

Pseudo Code:

r
a,b,e,x, c, fa, fb, fc : real;
i:integer;

begin
  a:= strtofloat (edit1.text);
  b:= strtofloat (edit2.Text);

  fa := cos(a) - (a*a);
  fb := cos(b) - (b*b);
    if fa*fb > 0 then  label1.Caption:='selang a dan b tidak memuat akar'
    else
    begin
    x:= strtofloat(edit3.Text);
    i:=-1;
    repeat
    i:= i+1;
    c:=(a+b)/2;
    listbox1.Items.add(floattostr(a));
    listbox2.Items.add(floattostr(b));
    listbox3.Items.add(floattostr(c));
    fa := cos(a) - (a*a);
    fb := cos(b) - (b*b);
    fc := cos(c) - (c*c);
    listbox4.Items.add(floattostr(fa));
    listbox5.Items.add(floattostr(fb));
    listbox6.Items.add(floattostr(fc));
    if fa*fc <= 0 then b:= c else a:=c;
    e:= abs ((b-a)/b);
    until e<= x;
    edit4.text:= floattostr(c);
    edit5.Text:= floattostr(i);
    end;
    end;

end.

0 comments:

Copyright © 2012 Zuka Zuka World | Hatsune Miku Theme | Designed by Johanes DJ