Sayfayı Yazdır | Pencereyi Kapat

pi işlemini ln gibi yazabilir miyiz?

Nereden Yazdırıldığı: Clomosy | Forum
Kategori: Genel Programlama
Forum Adı: Genel İşlemler
Forum Tanımlaması: TRObject dili ile programlama yaparken karşılaşılan genel işlemler
URL: https://forum.clomosy.com.tr/forum_posts.asp?TID=532
Tarih: 07 Ocak 2025 Saat 23:16
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: pi işlemini ln gibi yazabilir miyiz?
Mesajı Yazan: kader
Konu: pi işlemini ln gibi yazabilir miyiz?
Mesaj Tarihi: 31 Temmuz 2023 Saat 14:45
!!!!!!!!kodda 80 satırda procedure pial da hata veriyor.
const
Ln=2.14
const
pi=3.14
Var   
MyForm:TclForm;
testButton,testButton2 ,testButton3,testButton4,testButton5,testButton6,testButton7,testButton8,testButton9,testButton10,testButton11,testButton12,testButton13,testButton14,testButton15,testButton16,testButton17,testButton18,testButton19,testButton20,testButton21,testButton22,testButton23,testButton24,testButton25,testButton26:TclButton;
a,b:Integer;
editNumber:TclProEdit;
Mem: Integer;
Op: String;
floatt: float;
Function getSum(a,b: Integer):Integer;
  begin
     Result := a + b;
  end;
{
Function Ln( number: Extended) : Extended;
   begin
  
  floatt := Ln(number);
  end;
  }
procedure cagir
begin
  Case Op of
    '+': editNumber.Text:= IntToStr(Mem+StrToInt(editNumber.Text));
    '-': editNumber.Text:= IntToStr(Mem-StrToInt(editNumber.Text));
    '*': editNumber.Text:= IntToStr(Mem*StrToInt(editNumber.Text));
    '/': editNumber.Text:= IntToStr(Mem/StrToInt(editNumber.Text));
    'Ln' : 
    begin
    floatt := Mem;
    editNumber.Text:= FloatToStr(Ln(floatt));
    end;
    'pi':
    begin
    floatt := Mem;
    editNumber.Text:= FloatToStr(pi(floatt));
    end;
    
  end;
  
  //editNumber.Text:=IntToStr(getSum(a,b));
end; 

Procedure Topla;
begin
  Mem:= StrToInt(editNumber.Text);
  editNumber.Text:= '';
  Op:= '+';
end;


Procedure cikar;
begin
  Mem:= StrToInt(editNumber.Text);
  editNumber.Text:= '';
  Op:= '-';
end;
Procedure bolme;
begin
  Mem:= StrToInt(editNumber.Text);
  editNumber.Text:= '';
  Op:= '/';
end;


Procedure carpma;
begin
  Mem:= StrToInt(editNumber.Text);
  editNumber.Text:= '';
  Op:= '*';
end;
Procedure Lnalma;
begin
  Mem:= StrToInt(editNumber.Text);
  editNumber.Text:= '';
  Op:= 'Ln';
  Procedure pial;
begin
  Mem:= StrToInt(editNumber.Text);
  editNumber.Text:= '';
  Op:= 'pi';
end;
begin
MyForm := TclForm.Create(Self);
testButton:= MyForm.AddNewButton(MyForm,'testButton','3');
testButton.TextSettings.Font.Size:=50;
testButton.Align := alCenter;
testButton.Height := 50;
testButton.Width := 80;
testButton.Margins.Left:= 200;
MyForm.AddNewEvent(testButton,tbeOnClick,'editNumber.Text := editNumber.Text + ''3''');

testButton2:= MyForm.AddNewButton(MyForm,'testButton2','2');
testButton2.TextSettings.Font.Size:=50;
testButton2.Align := alCenter;
testButton2.Height := 50;
testButton2.Width := 80;
MyForm.AddNewEvent(testButton2,tbeOnClick,'editNumber.Text := editNumber.Text + ''2''' );



testButton3:= MyForm.AddNewButton(MyForm,'testButton3','1');
testButton3.TextSettings.Font.Size:=50;
testButton3.Align := alCenter;
testButton3.Height := 50;
testButton3.Width := 80;
testButton3.Margins.right:=200 ;
MyForm.AddNewEvent(testButton3,tbeOnClick,'editNumber.Text := editNumber.Text + ''1''' );

testButton4:= MyForm.AddNewButton(MyForm,'testButton4','4');
testButton4.TextSettings.Font.Size:=50;
testButton4.Align := alCenter;
testButton4.Height := 50;
testButton4.Width := 80;
testButton4.Margins.top:=200 ;
testButton4.Margins.right:= 200;
MyForm.AddNewEvent(testButton4,tbeOnClick,'editNumber.Text := editNumber.Text + ''4''' );

testButton5:= MyForm.AddNewButton(MyForm,'testButton5','5');
testButton5.TextSettings.Font.Size:=50;
testButton5.Align := alCenter;
testButton5.Height := 50;
testButton5.Width := 80;
testButton5.Margins.top:=200 ;
MyForm.AddNewEvent(testButton5,tbeOnClick,'editNumber.Text := editNumber.Text + ''5''');
 
testButton6:=MyForm.AddNewButton(MyForm,'testButton6','6');
testButton6.TextSettings.Font.Size:=50;
testButton6.Align := alCenter;
testButton6.Height := 50;
testButton6.Width := 80;
testButton6.Margins.top:=200 ;
testButton6.Margins.left:= 200;
MyForm.AddNewEvent(testButton6,tbeOnClick,'editNumber.Text := editNumber.Text + ''6''' );

testButton7:= MyForm.AddNewButton(MyForm,'testButton7','7');
testButton7.TextSettings.Font.Size:=50;
testButton7.Align := alCenter;
testButton7.Height := 50;
testButton7.Width := 80;
testButton7.Margins.top :=400;
testButton7.Margins.right:=200;
MyForm.AddNewEvent(testButton7,tbeOnClick,'editNumber.Text := editNumber.Text + ''7''' );

testButton8:= MyForm.AddNewButton(MyForm,'testButton8','8');
testButton8.TextSettings.Font.Size:=50;
testButton8.Align := alCenter;
testButton8.Height := 50;
testButton8.Width := 80;
testButton8.Margins.top :=400;
MyForm.AddNewEvent(testButton8,tbeOnClick,'editNumber.Text := editNumber.Text + ''8''' );

testButton9:= MyForm.AddNewButton(MyForm,'testButton9','9');
testButton9.TextSettings.Font.Size:=50;
testButton9.Align := alCenter;
testButton9.Height := 50;
testButton9.Width := 80;
testButton9.Margins.top :=400;
testButton9.Margins.left:=200;
MyForm.AddNewEvent(testButton9,tbeOnClick,'editNumber.Text := editNumber.Text + ''9''' );

testButton10:= MyForm.AddNewButton(MyForm,'testButton10','AC');
testButton10.TextSettings.Font.Size:=50;
testButton10.Align := alCenter;
testButton10.Height := 50;
testButton10.Width := 80;
testButton10.Margins.Bottom:=170;
testButton10.Margins.right :=200;
MyForm.AddNewEvent(testButton10,tbeOnClick,'editNumber.Text := ''''' );

testButton11:= MyForm.AddNewButton(MyForm,'testButton11','%');
testButton11.TextSettings.Font.Size:=50;
testButton11.Align := alCenter;
testButton11.Height := 50;
testButton11.Width := 80;
testButton11.Margins.Bottom:=170;
MyForm.AddNewEvent(testButton11,tbeOnClick,'editNumber.Text := ''%''' );


testButton12:= MyForm.AddNewButton(MyForm,'testButton12','√');
testButton12.TextSettings.Font.Size:=50;
testButton12.Align := alCenter;
testButton12.Height := 50;
testButton12.Width := 80;
testButton12.Margins.Bottom:=170;
testButton12.Margins.left :=200;
MyForm.AddNewEvent(testButton12,tbeOnClick,'editNumber.Text := ''√''' );

testButton13:= MyForm.AddNewButton(MyForm,'testButton13','/');
testButton13.TextSettings.Font.Size:=50;
testButton13.Align := alCenter;
testButton13.Height := 50;
testButton13.Width := 80;
testButton13.Margins.Bottom:=170;
testButton13.Margins.left :=300;
MyForm.AddNewEvent(testButton13,tbeOnClick,'bolme' );

testButton14:= MyForm.AddNewButton(MyForm,'testButton14','×');
testButton14.TextSettings.Font.Size:=50;
testButton14.Align := alCenter;
testButton14.Height := 50;
testButton14.Width := 80;
testButton14.Margins.left:=300 ;
MyForm.AddNewEvent(testButton14,tbeOnClick,'carpma');

testButton15:=MyForm.AddNewButton(MyForm,'testButton15','+');
testButton15.TextSettings.Font.Size:=50;
testButton15.Align := alCenter;
testButton15.Height := 50;
testButton15.Width := 80;
testButton15.Margins.top:=200 ;
testButton15.Margins.left:= 300;
MyForm.AddNewEvent(testButton15,tbeOnClick,'Topla');

testButton16:= MyForm.AddNewButton(MyForm,'testButton16','-');
testButton16.TextSettings.Font.Size:=50;
testButton16.Align := alCenter;
testButton16.Height := 50;
testButton16.Width := 80;
testButton16.Margins.top :=400;
testButton16.Margins.left:=300;
MyForm.AddNewEvent(testButton16,tbeOnClick,'cikar' );

testButton17:= MyForm.AddNewButton(MyForm,'testButton17','0');
testButton17.TextSettings.Font.Size:=50;
testButton17.Align := alCenter;
testButton17.Height := 50;
testButton17.Width := 80;
testButton17.Margins.top :=550;
MyForm.AddNewEvent(testButton17,tbeOnClick,'editNumber.Text := editNumber.Text + ''0''' );

testButton20:= MyForm.AddNewButton(MyForm,'testButton20','=');
testButton20.TextSettings.Font.Size:=50;
testButton20.Align := alCenter;
testButton20.Height := 50;
testButton20.Width := 80;
testButton20.Margins.top :=550;
testButton20.Margins.left:=300;
MyForm.AddNewEvent(testButton20,tbeOnClick,'cagir');
  
testButton21:= MyForm.AddNewButton(MyForm,'testButton21','log');
testButton21.TextSettings.Font.Size:=50;
testButton21.Align := alCenter;
testButton21.Height := 50;
testButton21.Width := 80;
testButton21.Margins.Bottom:=170;
testButton21.Margins.right :=300;
MyForm.AddNewEvent(testButton21,tbeOnClick,'' );

testButton22:= MyForm.AddNewButton(MyForm,'testButton22','sin');
testButton22.TextSettings.Font.Size:=50;
testButton22.Align := alCenter;
testButton22.Height := 50;
testButton22.Width := 80;
testButton22.Margins.right:=300 ;
MyForm.AddNewEvent(testButton22,tbeOnClick,'' );

testButton23:= MyForm.AddNewButton(MyForm,'testButton23','Ln');
testButton23.TextSettings.Font.Size:=50;
testButton23.Align := alCenter;
testButton23.Height := 50;
testButton23.Width := 80;
testButton23.Margins.top:=200 ;
testButton23.Margins.right:= 300;
MyForm.AddNewEvent(testButton23,tbeOnClick,'Lnalma');
testButton24:= MyForm.AddNewButton(MyForm,'testButton24','π');
testButton24.TextSettings.Font.Size:=50;
testButton24.Align := alCenter;
testButton24.Height := 50;
testButton24.Width := 100;
testButton24.Margins.top :=400;
testButton24.Margins.right:=300;
MyForm.AddNewEvent(testButton24,tbeOnClick,'pial');

editNumber := MyForm.AddNewProEdit(MyForm,'editNumber','');
clComponent.SetupComponent(editNumber,'{"Align" : "Center",
"MarginBottom":135,
"MarginTop":-185,
"Width" :180, "Height":100,
"RoundHeight":10,"RoundWidth":10,
"MarginLeft":30}');
MyForm.AddNewEvent(editNumber,tbeOnClick,'cagir' );
MyForm.Run;

end;




Cevaplar:
Mesajı Yazan: Alforce
Mesaj Tarihi: 31 Temmuz 2023 Saat 15:04
Lütfen genel forum kurallarına uyun.
Forumlarda büyük harflerle yazmak ve ünlem işaretleri hoş karşılanmaz.
Ve aldığınız bütün sorunları buraya yazmakda.

Burda sorun Lnalma prosedürünün kod bloğunu başlatmanıza rağmen(Begin), bitirmemişsiniz(End;).

Olması gereken:
Procedure Lnalma;
begin
  Mem:= StrToInt(editNumber.Text);
  editNumber.Text:= '';
  Op:= 'Ln';
End;

Procedure pial;
begin
  Mem:= StrToInt(editNumber.Text);
  editNumber.Text:= '';
  Op:= 'pi';
end;


Mesajı Yazan: kader
Mesaj Tarihi: 31 Temmuz 2023 Saat 15:20



Sayfayı Yazdır | Pencereyi Kapat

Forum Software by Web Wiz Forums® version 12.07 - https://www.webwizforums.com
Copyright ©2001-2024 Web Wiz Ltd. - https://www.webwiz.net