![]() |
|
|
#1 (permalink) |
|
Yüzbaşı
![]() Üyelik tarihi: Jul 2007
Mesajlar: 251
|
Sayı Tahmin Programı
Aklinizdan tuttuğunuz sayiyi en fazla 7 tahminde bulan program
![]() Kod: unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementationuses Math;{$R *.dfm}vartahmin,yeni,enyeni:real; tur:integer;procedure TForm1.Button1Click(Sender: TObject);begin if Edit1.Text=" then begin yeni:=50; tur:=0; tahmin:=0; end; if Edit1.Text=" then begin Label1.Caption:=floattostr(yeni); tur:=1; Label4.Caption:=inttostr(tur); end; if Edit1.Text='2' then begin yeni:=StrToFloat(Label1.Caption); enyeni:= yeni+ abs(yeni-(tahmin))/2; Label1.Caption:=FloatToStr(floor(enyeni)); tahmin:=yeni; tur:=tur+1; Label4.Caption:=inttostr(tur); end; if Edit1.Text='1' then begin yeni:=StrToFloat(Label1.Caption); enyeni:= yeni-abs(yeni-tahmin)/2; tahmin:=yeni; Label1.Caption:=FloatToStr(floor(enyeni)); tur:=tur+1; Label4.Caption:=inttostr(tur); end; if edit1.text='0' then showmessage('Sayınız:'+label1.caption);end;end.
__________________
[Linkleri görebilmek için üye olmalısınız. Üye olmak için tıklayınız...] Yukarıdaki İşaretlenmİş OLan yere TıkLayarak UYgunsuz Kullanımları moderatörlere veya Adminlere Bildirebilirsiniz. BilGiniZe... 8D1T 8y 4kR3p |
|
|
|
![]() |
| Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir) | |
| Seçenekler | |
| Stil | |
|
|