Dönüşüm Hatası

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
Kullanıcı avatarı
ademiz
Üye
Mesajlar: 151
Kayıt: 30 Tem 2003 02:41
Konum: İstanbul
İletişim:

Dönüşüm Hatası

Mesaj gönderen ademiz »

Kod: Tümünü seç

1- procedure TForm1.FormCreate(Sender: TObject);
2- var okunan,cont,toplam:Integer; gun:String;
3- begin
4-   cont :=500;
5-   toplam :=0;
6-   ADOTable1.First;
7-   while not ADOTable1.Eof do
8-     begin
9-       toplam := toplam + ADOTable1.Fields[4].AsInteger;
10-       ADOTable1.Next;
11-     end;
12-   Label2.Caption := IntToStr(toplam);
13-  begin
14-     gun := FloatToStr(Date - DateTimePicker1.Date);
15-     okunan := cont * StrToInt(gun);
16-     ADOTable1.Edit;
17-     ADOTable1.FieldByName('Durum').AsString := FormatFloat('#,#',okunan);
18-  end;
19- end;
Arkadaşlar Merhaba

Yukardaki kodu çalıştıramıyorum!

15. Satırda dönüşüm hatası veriyor.Neyi denediysem bir türlü hatasız çalıştıramadım.Bir yol bulup hatasız çalıştırsam bile bu seferde

17. Satırdaki sonuç anormal çıktı.

Bu konuda şu hatayı göremeyen gözlerimi uykudan uyandıracak arkadaşların cevabını bekliyorum :oops:

Hepinize Saygılar
bgoktas
Kıdemli Üye
Mesajlar: 769
Kayıt: 27 Nis 2004 10:32
Konum: istanbul

Mesaj gönderen bgoktas »

gun := FloatToStr( trunc(strtofloat(datetostr(Date - DateTimePicker1.Date))));
şeklinde deneyebilirmisiniz...
Kullanıcı avatarı
ademiz
Üye
Mesajlar: 151
Kayıt: 30 Tem 2003 02:41
Konum: İstanbul
İletişim:

Mesaj gönderen ademiz »

bgoktas hocam olmadı
Kullanıcı avatarı
Fatih!
Kıdemli Üye
Mesajlar: 1172
Kayıt: 26 Kas 2004 10:46
Konum: Malatya
İletişim:

Mesaj gönderen Fatih! »

Reel tipteki sayılarıları şu şekilde çevir
VAL(string,sayi,sonuc);
sonuç 0 dan farklıysa çevirme başarısız demektir
Kullanıcı avatarı
mussimsek
Admin
Mesajlar: 7603
Kayıt: 10 Haz 2003 12:26
Konum: İstanbul
İletişim:

Mesaj gönderen mussimsek »

gun değişkenini integer yap ve DaysBetween veya ona benzer bir fonksiyon kullan : http://www.delphiturkiye.com/index.php? ... tetime.htm

Bu tarz dönüişümleri de çok zorda kalmayınca kullanmayın :!:

Kolay gelsin.
Kullanıcı avatarı
TRSoft
Kıdemli Üye
Mesajlar: 636
Kayıt: 13 Şub 2004 11:39
Konum: Konya
İletişim:

Mesaj gönderen TRSoft »

Hocam bu 13. satırdaki Begin blok başlangıcı neyin begini ben onu bulamadım. Kodunun tamamını buraya yazmamış olabilirsin. Bi kontrol etsen iyi olur. Belki gözden kaçan bir nokta vardır..
İlimle geçen bir gece,
ibadetle geçen bin geceden hayırlıdır.
HZ. MUHAMMED (S.A.)
Kullanıcı avatarı
husonet
Admin
Mesajlar: 2962
Kayıt: 25 Haz 2003 02:14
Konum: İstanbul
İletişim:

Mesaj gönderen husonet »

Kod: Tümünü seç

1- procedure TForm1.FormCreate(Sender: TObject); 
2- var okunan,cont,toplam:Integer; gun:String; 
3- begin 
4-   cont :=500; //ilk değer atamaları yapıldı
5-   toplam :=0; 
6-   ADOTable1.First; //ilk kayıta gidildi
7-   while not ADOTable1.Eof do //Dosya sonuna kadar 4 üncü field alanın toplamları için döngü kuruldu 
8-     begin 
9-       toplam := toplam + ADOTable1.Fields[4].AsInteger;//Not: Fieldlara numarayla ulaşmak okunabilirliği ve Database güncellemelirnde problem çıkartır FieldByName özelliğinden yararlanın ;)
10-       ADOTable1.Next; 
11-     end; 
12-   Label2.Caption := IntToStr(toplam); //Toplam Labelda
13-  begin //Nedir bu? Ne işe yarar?
14-     gun := FloatToStr(Date - DateTimePicker1.Date); //Tarih Hesaplaması yapıldı 
15-     okunan := cont * StrToInt(gun); 
16-     ADOTable1.Edit; //Hop ya Table nerde şimdi? Son kayıtta ?
17-     ADOTable1.FieldByName('Durum').AsString := FormatFloat('#,#',okunan); //Atama yapıldı

//iyi güzelde Edit pozisyonundaki table neden post olmadı?
18-  end; 
19- end;
Kolay Gelsin...

Gazete manşetleri
* DİKKAT :Lütfen forum kurallarını okuyalım ve uyalım...!
* Warez,crack vs. paylaşımı kesinlikle yasaktır.
Kullanıcı avatarı
ademiz
Üye
Mesajlar: 151
Kayıt: 30 Tem 2003 02:41
Konum: İstanbul
İletişim:

Mesaj gönderen ademiz »

TRSoft

Hocam 13, satırdan başlayıp
18. satırda end bloğuyla bitiyor.
Kullanıcı avatarı
husonet
Admin
Mesajlar: 2962
Kayıt: 25 Haz 2003 02:14
Konum: İstanbul
İletişim:

Mesaj gönderen husonet »

Hata almana sebep olan satır bu okunan := cont * StrToInt(gun); sebebi ise çıkan sonuç bir integer değişkenin sınırlarını aşıyor.

Kolay Gelsin...

Gazete manşetleri
* DİKKAT :Lütfen forum kurallarını okuyalım ve uyalım...!
* Warez,crack vs. paylaşımı kesinlikle yasaktır.
algorian
Üye
Mesajlar: 20
Kayıt: 24 Kas 2004 10:54

Mesaj gönderen algorian »

Önce Floattan stringe çeviriyorsun.

Kod: Tümünü seç

gun := FloatToStr(Date - DateTimePicker1.Date);
Sonra da string'den integere.

Kod: Tümünü seç

okunan := cont * StrToInt(gun); 
Sayı virgüllü olduğu için integer'a dönüştürülemiyor.
Çünkü şu an ile dateTimePicker'daki zamanın farkının tamsayı olması (Date tipi saati de içerir) ihtimali 24*60*60*100 de 1 dir. O yüzden virgülü atman lazım.

Kod: Tümünü seç

gun := FloatToStr(Floor(Date - DateTimePicker1.Date));
Not : Uses'a Math eklemeyi unutma !
Kullanıcı avatarı
webaytek
Üye
Mesajlar: 377
Kayıt: 23 Haz 2004 10:58

Mesaj gönderen webaytek »

ben bu delphinin deeee... :)
yaw kusuruma bakmayın - tl-ytl falan bişiylerle uğraşıyorum ama amatörce :D
biryerde takıldım... siz de aşamazsanız delphiyi bırakıyorum :D

---------1. Seçenek----------
var ykrs:string
ykrs_bir_arttir:integer
olmak kaydıyla
ykrs_bir_arttir ilaaaaaaaki ykrsden 1 büyük olmak zorunda

---------2. Seçenek----------
yukarıdaki olmazsa 2.seçenek şu olmalı
05 gibi bir rakamı string yine 05 olarak okuyabiliyor
ama integer yapınca rakam birden 5 oluyor. yukarıdaki sorun da buradan kaynaklanıyor. ya rakamsal bir veri tipi önerin (05) olarak alınabilecek
ya da 1.dediğimdeki gibi bir formülü strtoint yada inttostr kullanmadan çözmeye çalışın - tabii ki strtoint hata verdiği için bu şekilde bir derdim oldu - çözebilirseniz ne mutlu BANA :D - KOLAY GELSİN
Misafir

Mesaj gönderen Misafir »

merhaba.
hocam hesap makinasına 05 yazabiliyor musunuz :) matematikten gelen temel bi olay bu..ancak 0,05 derseniz bunu kabul eder.
kolay gelsin.
Kullanıcı avatarı
webaytek
Üye
Mesajlar: 377
Kayıt: 23 Haz 2004 10:58

Mesaj gönderen webaytek »

delphi_coder kardeşim ama benim bu işi ya stringle yada başka yolla yapmam lazım benim derdim de bu zaten ya 05 olarak kabul edecek bir veritipi çevirisi (strtoint tarzı) yada
1.değişkenim (ykrs)
2.değişkenim (ykrs_bir_arttir) den bir sayi küçük olacak yada tersi farketmez...

hee yok bu iş asla olmaz diyorsanız
koda bir göz atın çözümü siz önerin

Kod: Tümünü seç

unit Unit1;

interface

uses
  Clipbrd, Registry, Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    yuvarlanmamis: TEdit;
    Button1: TButton;
    saytext: TEdit;
    TL_yazi: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Image1: TImage;
    yuvarlanmis: TEdit;
    Label4: TLabel;
    ustte: TCheckBox;
    PanodanYapistir_saat: TTimer;
    Image3: TImage;
    Image4: TImage;
    Edit1: TEdit;
    oku: TButton;
    sadeceytltext: TEdit;
    sadeceyKrstext: TEdit;
    Button2: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
    procedure saytextKeyPress(Sender: TObject; var Key: Char);
    procedure FormCreate(Sender: TObject);
    procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Image1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure ustteClick(Sender: TObject);
    procedure Image3Click(Sender: TObject);
    procedure Image4Click(Sender: TObject);
    procedure okuClick(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    ykrs_arti_bir,say:integer;
    yuvarlatilmis,sadeceyTL,YTL,YKrs,yKrs_bir,yKrs_iki:string;
    birler,onlar,yuzler,binler,onbinler,yuzbinler:string;
  end;

var
  Form1: TForm1;
  Reg:Tregistry;
implementation

uses Unit2;

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
[b]yKrs_arti_bir:=strtoint(yKrs)+1;[/b] [i][b]//sorun burası[/b][/i]
if length(saytext.text) = 0 then begin saytext.text:='0'; saytext.SelectAll end;
//yKrs:='';
yKrs_bir:='';
yKrs_iki:='';
if length(saytext.text) < 7 then
        begin
        edit1.text:='';
        end
else
        begin
        end;
say:=length(saytext.text);
yTL:=copy(saytext.text,1,say-6);
yKrs:=copy(saytext.text,say-5,2);
yuvarlatilmis:=copy(saytext.text,say-3,say);
if say >= 7 then
        begin
                if strtoint(copy(saytext.text,say-3,2)) < 50 then
                        begin
                        yuvarlanmamis.text:=copy(saytext.text,1,say-6)+' YTL '+copy(saytext.text,say-5,2)+','+yuvarlatilmis+' YKrş';
                        yuvarlanmis.text:='Yuvarlama Yok';
                        end
                else
                        begin
                        yuvarlanmis.text:=copy(saytext.text,1,say-6)+' YTL '+inttostr(yKrs_arti_bir)+' YKrş';
                        yuvarlanmamis.text:=copy(saytext.text,1,say-6)+' YTL '+YKrs+','+yuvarlatilmis+' YKrş';
                        end;
        end;
if say = 6 then yuvarlanmamis.text:='0,'+copy(saytext.text,1,1)+copy(saytext.text,2,say)+' YKrş';
if say = 5 then yuvarlanmamis.text:='0,0'+copy(saytext.text,1,1)+copy(saytext.text,2,say)+' YKrş';
if say = 4 then yuvarlanmamis.text:='0,00'+copy(saytext.text,1,1)+copy(saytext.text,2,say)+' YKrş';
if say = 3 then yuvarlanmamis.text:='0,000'+copy(saytext.text,1,1)+copy(saytext.text,2,say)+' YKrş';
if say = 2 then yuvarlanmamis.text:='0,0000'+copy(saytext.text,1,1)+copy(saytext.text,2,say)+' YKrş';
if say = 1 then yuvarlanmamis.text:='0,00000'+copy(saytext.text,1,1)+copy(saytext.text,2,say)+' YKrş';
oku.click;
button2.click;
end;

procedure TForm1.saytextKeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9',#8]) then
        begin
        Beep;
	Key:=#0;
        end
end;

procedure TForm1.FormCreate(Sender: TObject);
begin

button1.Click;
Reg:=Tregistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey('\SOFTWARE\Microsoft',true);

if reg.ReadString('Count')  = '' then
        begin
        reg.WriteString('Count','1');
        showmessage('Program yanlızca bir kez çalışacaktır. Programı sürekli kullanmak için satın almalısınız...');
        end
else
        begin
//        showmessage('Program önceden bir kere çalıştırılmış olduğu algılandı. Program sonlandırılacak... Programı kullanmaya devam etmek istiyorsanız irtibat:WebAytek');
//        application.terminate
        end;
end;

procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
form2.FormStyle:=fsstayontop;
FORM2.show;
end;

procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
form2.Hide;
end;

procedure TForm1.ustteClick(Sender: TObject);
begin
if ustte.Checked = true then
form1.formstyle:=fsStayOnTop
else
form1.formstyle:=fsNormal;
end;

procedure TForm1.Image3Click(Sender: TObject);
begin
yuvarlanmamis.SelectAll;
yuvarlanmamis.CopyToClipboard;
end;

procedure TForm1.Image4Click(Sender: TObject);
begin
yuvarlanmis.SelectAll;
yuvarlanmis.CopyToClipboard;
end;

procedure TForm1.okuClick(Sender: TObject);
begin
sadeceyTL:=copy(saytext.text,1,say-6);
sadeceyTLtext.text:=sadeceyTL;
if strtoint(copy(saytext.text,say-3,2)) < 50 then
        begin
        yKrs:=yKrs;
        sadeceyKrstext.text:=yKrs;
        end
else
        begin
        yKrs:=inttostr(yKrs_arti_bir);
        sadeceyKrstext.text:=yKrs;
        end;

if length(sadeceytltext.text) = 1 then begin
        if copy(sadeceytltext.text,1,1) = '0' then Birler:='';
        if copy(sadeceytltext.text,1,1) = '1' then Birler:='Bir';
        if copy(sadeceytltext.text,1,1) = '2' then Birler:='İki';
        if copy(sadeceytltext.text,1,1) = '3' then Birler:='Üç';
        if copy(sadeceytltext.text,1,1) = '4' then Birler:='Dört';
        if copy(sadeceytltext.text,1,1) = '5' then Birler:='Beş';
        if copy(sadeceytltext.text,1,1) = '6' then Birler:='Altı';
        if copy(sadeceytltext.text,1,1) = '7' then Birler:='Yedi';
        if copy(sadeceytltext.text,1,1) = '8' then Birler:='Sekiz';
        if copy(sadeceytltext.text,1,1) = '9' then Birler:='Dokuz';

        if copy(yKrs,1,1) = '0' then yKrs_bir:='';
        if copy(yKrs,1,1) = '1' then yKrs_bir:='On';
        if copy(yKrs,1,1) = '2' then yKrs_bir:='Yirmi';
        if copy(yKrs,1,1) = '3' then yKrs_bir:='Otuz';
        if copy(yKrs,1,1) = '4' then yKrs_bir:='Kırk';
        if copy(yKrs,1,1) = '5' then yKrs_bir:='Elli';
        if copy(yKrs,1,1) = '6' then yKrs_bir:='Altmış';
        if copy(yKrs,1,1) = '7' then yKrs_bir:='Yetmiş';
        if copy(yKrs,1,1) = '8' then yKrs_bir:='Seksen';
        if copy(yKrs,1,1) = '9' then yKrs_bir:='Doksan';
        if copy(yKrs,2,1) = '0' then yKrs_iki:='';
        if copy(yKrs,2,1) = '1' then yKrs_iki:='Bir';
        if copy(yKrs,2,1) = '2' then yKrs_iki:='İki';
        if copy(yKrs,2,1) = '3' then yKrs_iki:='Üç';
        if copy(yKrs,2,1) = '4' then yKrs_iki:='Dört';
        if copy(yKrs,2,1) = '5' then yKrs_iki:='Beş';
        if copy(yKrs,2,1) = '6' then yKrs_iki:='Altı';
        if copy(yKrs,2,1) = '7' then yKrs_iki:='Yedi';
        if copy(yKrs,2,1) = '8' then yKrs_iki:='Sekiz';
        if copy(yKrs,2,1) = '9' then yKrs_iki:='Dokuz';
        edit1.text:=Birler+' Lira '+yKrs_bir+yKrs_iki+' Kuruş';
end;

if length(sadeceytltext.text) = 2 then begin
        if copy(sadeceytltext.text,1,1) = '0' then Onlar:='';
        if copy(sadeceytltext.text,1,1) = '1' then Onlar:='On';
        if copy(sadeceytltext.text,1,1) = '2' then Onlar:='Yirmi';
        if copy(sadeceytltext.text,1,1) = '3' then Onlar:='Otuz';
        if copy(sadeceytltext.text,1,1) = '4' then Onlar:='Kırk';
        if copy(sadeceytltext.text,1,1) = '5' then Onlar:='Elli';
        if copy(sadeceytltext.text,1,1) = '6' then Onlar:='Altmış';
        if copy(sadeceytltext.text,1,1) = '7' then Onlar:='Yetmiş';
        if copy(sadeceytltext.text,1,1) = '8' then Onlar:='Seksen';
        if copy(sadeceytltext.text,1,1) = '9' then Onlar:='Doksan';
        if copy(sadeceytltext.text,2,1) = '0' then Birler:='';
        if copy(sadeceytltext.text,2,1) = '1' then Birler:='Bir';
        if copy(sadeceytltext.text,2,1) = '2' then Birler:='İki';
        if copy(sadeceytltext.text,2,1) = '3' then Birler:='Üç';
        if copy(sadeceytltext.text,2,1) = '4' then Birler:='Dört';
        if copy(sadeceytltext.text,2,1) = '5' then Birler:='Beş';
        if copy(sadeceytltext.text,2,1) = '6' then Birler:='Altı';
        if copy(sadeceytltext.text,2,1) = '7' then Birler:='Yedi';
        if copy(sadeceytltext.text,2,1) = '8' then Birler:='Sekiz';
        if copy(sadeceytltext.text,2,1) = '9' then Birler:='Dokuz';

        if copy(yKrs,1,1) = '0' then yKrs_bir:='';
        if copy(yKrs,1,1) = '1' then yKrs_bir:='On';
        if copy(yKrs,1,1) = '2' then yKrs_bir:='Yirmi';
        if copy(yKrs,1,1) = '3' then yKrs_bir:='Otuz';
        if copy(yKrs,1,1) = '4' then yKrs_bir:='Kırk';
        if copy(yKrs,1,1) = '5' then yKrs_bir:='Elli';
        if copy(yKrs,1,1) = '6' then yKrs_bir:='Altmış';
        if copy(yKrs,1,1) = '7' then yKrs_bir:='Yetmiş';
        if copy(yKrs,1,1) = '8' then yKrs_bir:='Seksen';
        if copy(yKrs,1,1) = '9' then yKrs_bir:='Doksan';
        if copy(yKrs,2,1) = '0' then yKrs_iki:='';
        if copy(yKrs,2,1) = '1' then yKrs_iki:='Bir';
        if copy(yKrs,2,1) = '2' then yKrs_iki:='İki';
        if copy(yKrs,2,1) = '3' then yKrs_iki:='Üç';
        if copy(yKrs,2,1) = '4' then yKrs_iki:='Dört';
        if copy(yKrs,2,1) = '5' then yKrs_iki:='Beş';
        if copy(yKrs,2,1) = '6' then yKrs_iki:='Altı';
        if copy(yKrs,2,1) = '7' then yKrs_iki:='Yedi';
        if copy(yKrs,2,1) = '8' then yKrs_iki:='Sekiz';
        if copy(yKrs,2,1) = '9' then yKrs_iki:='Dokuz';
        edit1.text:=Onlar+Birler+' Lira '+yKrs_bir+yKrs_iki+' Kuruş';
end;

if length(sadeceytltext.text) = 3 then begin
        if copy(sadeceytltext.text,1,1) = '0' then Yuzler:='';
        if copy(sadeceytltext.text,1,1) = '1' then Yuzler:='Yüz';
        if copy(sadeceytltext.text,1,1) = '2' then Yuzler:='İkiYüz';
        if copy(sadeceytltext.text,1,1) = '3' then Yuzler:='ÜçYüz';
        if copy(sadeceytltext.text,1,1) = '4' then Yuzler:='DörtYüz';
        if copy(sadeceytltext.text,1,1) = '5' then Yuzler:='BeşYüz';
        if copy(sadeceytltext.text,1,1) = '6' then Yuzler:='AltıYüz';
        if copy(sadeceytltext.text,1,1) = '7' then Yuzler:='YediYüz';
        if copy(sadeceytltext.text,1,1) = '8' then Yuzler:='SekizYüz';
        if copy(sadeceytltext.text,1,1) = '9' then Yuzler:='DokuzYüz';
        if copy(sadeceytltext.text,2,1) = '0' then Onlar:='';
        if copy(sadeceytltext.text,2,1) = '1' then Onlar:='On';
        if copy(sadeceytltext.text,2,1) = '2' then Onlar:='Yirmi';
        if copy(sadeceytltext.text,2,1) = '3' then Onlar:='Otuz';
        if copy(sadeceytltext.text,2,1) = '4' then Onlar:='Kırk';
        if copy(sadeceytltext.text,2,1) = '5' then Onlar:='Elli';
        if copy(sadeceytltext.text,2,1) = '6' then Onlar:='Altmış';
        if copy(sadeceytltext.text,2,1) = '7' then Onlar:='Yetmiş';
        if copy(sadeceytltext.text,2,1) = '8' then Onlar:='Seksen';
        if copy(sadeceytltext.text,2,1) = '9' then Onlar:='Doksan';
        if copy(sadeceytltext.text,3,1) = '0' then Birler:='';
        if copy(sadeceytltext.text,3,1) = '1' then Birler:='Bir';
        if copy(sadeceytltext.text,3,1) = '2' then Birler:='İki';
        if copy(sadeceytltext.text,3,1) = '3' then Birler:='Üç';
        if copy(sadeceytltext.text,3,1) = '4' then Birler:='Dört';
        if copy(sadeceytltext.text,3,1) = '5' then Birler:='Beş';
        if copy(sadeceytltext.text,3,1) = '6' then Birler:='Altı';
        if copy(sadeceytltext.text,3,1) = '7' then Birler:='Yedi';
        if copy(sadeceytltext.text,3,1) = '8' then Birler:='Sekiz';
        if copy(sadeceytltext.text,3,1) = '9' then Birler:='Dokuz';

        if copy(yKrs,1,1) = '0' then yKrs_bir:='';
        if copy(yKrs,1,1) = '1' then yKrs_bir:='On';
        if copy(yKrs,1,1) = '2' then yKrs_bir:='Yirmi';
        if copy(yKrs,1,1) = '3' then yKrs_bir:='Otuz';
        if copy(yKrs,1,1) = '4' then yKrs_bir:='Kırk';
        if copy(yKrs,1,1) = '5' then yKrs_bir:='Elli';
        if copy(yKrs,1,1) = '6' then yKrs_bir:='Altmış';
        if copy(yKrs,1,1) = '7' then yKrs_bir:='Yetmiş';
        if copy(yKrs,1,1) = '8' then yKrs_bir:='Seksen';
        if copy(yKrs,1,1) = '9' then yKrs_bir:='Doksan';
        if copy(yKrs,2,1) = '0' then yKrs_iki:='';
        if copy(yKrs,2,1) = '1' then yKrs_iki:='Bir';
        if copy(yKrs,2,1) = '2' then yKrs_iki:='İki';
        if copy(yKrs,2,1) = '3' then yKrs_iki:='Üç';
        if copy(yKrs,2,1) = '4' then yKrs_iki:='Dört';
        if copy(yKrs,2,1) = '5' then yKrs_iki:='Beş';
        if copy(yKrs,2,1) = '6' then yKrs_iki:='Altı';
        if copy(yKrs,2,1) = '7' then yKrs_iki:='Yedi';
        if copy(yKrs,2,1) = '8' then yKrs_iki:='Sekiz';
        if copy(yKrs,2,1) = '9' then yKrs_iki:='Dokuz';
        edit1.text:=Yuzler+Onlar+Birler+' Lira '+yKrs_bir+yKrs_iki+' Kuruş';
end;

if length(sadeceytltext.text) = 4 then begin
        if copy(sadeceytltext.text,1,1) = '0' then Binler:='';
        if copy(sadeceytltext.text,1,1) = '1' then Binler:='Bin';
        if copy(sadeceytltext.text,1,1) = '2' then Binler:='İkiBin';
        if copy(sadeceytltext.text,1,1) = '3' then Binler:='ÜçBin';
        if copy(sadeceytltext.text,1,1) = '4' then Binler:='DörtBin';
        if copy(sadeceytltext.text,1,1) = '5' then Binler:='BeşBin';
        if copy(sadeceytltext.text,1,1) = '6' then Binler:='AltıBin';
        if copy(sadeceytltext.text,1,1) = '7' then Binler:='YediBin';
        if copy(sadeceytltext.text,1,1) = '8' then Binler:='SekizBin';
        if copy(sadeceytltext.text,1,1) = '9' then Binler:='DokuzBin';
        if copy(sadeceytltext.text,2,1) = '0' then Yuzler:='';
        if copy(sadeceytltext.text,2,1) = '1' then Yuzler:='Yüz';
        if copy(sadeceytltext.text,2,1) = '2' then Yuzler:='İkiYüz';
        if copy(sadeceytltext.text,2,1) = '3' then Yuzler:='ÜçYüz';
        if copy(sadeceytltext.text,2,1) = '4' then Yuzler:='DörtYüz';
        if copy(sadeceytltext.text,2,1) = '5' then Yuzler:='BeşYüz';
        if copy(sadeceytltext.text,2,1) = '6' then Yuzler:='AltıYüz';
        if copy(sadeceytltext.text,2,1) = '7' then Yuzler:='YediYüz';
        if copy(sadeceytltext.text,2,1) = '8' then Yuzler:='SekizYüz';
        if copy(sadeceytltext.text,2,1) = '9' then Yuzler:='DokuzYüz';
        if copy(sadeceytltext.text,3,1) = '0' then Onlar:='';
        if copy(sadeceytltext.text,3,1) = '1' then Onlar:='On';
        if copy(sadeceytltext.text,3,1) = '2' then Onlar:='Yirmi';
        if copy(sadeceytltext.text,3,1) = '3' then Onlar:='Otuz';
        if copy(sadeceytltext.text,3,1) = '4' then Onlar:='Kırk';
        if copy(sadeceytltext.text,3,1) = '5' then Onlar:='Elli';
        if copy(sadeceytltext.text,3,1) = '6' then Onlar:='Altmış';
        if copy(sadeceytltext.text,3,1) = '7' then Onlar:='Yetmiş';
        if copy(sadeceytltext.text,3,1) = '8' then Onlar:='Seksen';
        if copy(sadeceytltext.text,3,1) = '9' then Onlar:='Doksan';
        if copy(sadeceytltext.text,4,1) = '0' then Birler:='';
        if copy(sadeceytltext.text,4,1) = '1' then Birler:='Bir';
        if copy(sadeceytltext.text,4,1) = '2' then Birler:='İki';
        if copy(sadeceytltext.text,4,1) = '3' then Birler:='Üç';
        if copy(sadeceytltext.text,4,1) = '4' then Birler:='Dört';
        if copy(sadeceytltext.text,4,1) = '5' then Birler:='Beş';
        if copy(sadeceytltext.text,4,1) = '6' then Birler:='Altı';
        if copy(sadeceytltext.text,4,1) = '7' then Birler:='Yedi';
        if copy(sadeceytltext.text,4,1) = '8' then Birler:='Sekiz';
        if copy(sadeceytltext.text,4,1) = '9' then Birler:='Dokuz';

        if copy(yKrs,1,1) = '0' then yKrs_bir:='';
        if copy(yKrs,1,1) = '1' then yKrs_bir:='On';
        if copy(yKrs,1,1) = '2' then yKrs_bir:='Yirmi';
        if copy(yKrs,1,1) = '3' then yKrs_bir:='Otuz';
        if copy(yKrs,1,1) = '4' then yKrs_bir:='Kırk';
        if copy(yKrs,1,1) = '5' then yKrs_bir:='Elli';
        if copy(yKrs,1,1) = '6' then yKrs_bir:='Altmış';
        if copy(yKrs,1,1) = '7' then yKrs_bir:='Yetmiş';
        if copy(yKrs,1,1) = '8' then yKrs_bir:='Seksen';
        if copy(yKrs,1,1) = '9' then yKrs_bir:='Doksan';
        if copy(yKrs,2,1) = '0' then yKrs_iki:='';
        if copy(yKrs,2,1) = '1' then yKrs_iki:='Bir';
        if copy(yKrs,2,1) = '2' then yKrs_iki:='İki';
        if copy(yKrs,2,1) = '3' then yKrs_iki:='Üç';
        if copy(yKrs,2,1) = '4' then yKrs_iki:='Dört';
        if copy(yKrs,2,1) = '5' then yKrs_iki:='Beş';
        if copy(yKrs,2,1) = '6' then yKrs_iki:='Altı';
        if copy(yKrs,2,1) = '7' then yKrs_iki:='Yedi';
        if copy(yKrs,2,1) = '8' then yKrs_iki:='Sekiz';
        if copy(yKrs,2,1) = '9' then yKrs_iki:='Dokuz';
        edit1.text:=Binler+Yuzler+Onlar+Birler+' Lira '+yKrs_bir+yKrs_iki+' Kuruş';
end;

if length(sadeceytltext.text) = 5 then begin
        if copy(sadeceytltext.text,1,1) = '0' then OnBinler:='';
        if copy(sadeceytltext.text,1,1) = '1' then OnBinler:='On';
        if copy(sadeceytltext.text,1,1) = '2' then OnBinler:='Yirmi';
        if copy(sadeceytltext.text,1,1) = '3' then OnBinler:='Otuz';
        if copy(sadeceytltext.text,1,1) = '4' then OnBinler:='Kırk';
        if copy(sadeceytltext.text,1,1) = '5' then OnBinler:='Elli';
        if copy(sadeceytltext.text,1,1) = '6' then OnBinler:='Altmış';
        if copy(sadeceytltext.text,1,1) = '7' then OnBinler:='Yetmiş';
        if copy(sadeceytltext.text,1,1) = '8' then OnBinler:='Seksen';
        if copy(sadeceytltext.text,1,1) = '9' then OnBinler:='Doksan';
        if copy(sadeceytltext.text,2,1) = '0' then Binler:='Bin';
        if copy(sadeceytltext.text,2,1) = '1' then Binler:='BirBin';      
        if copy(sadeceytltext.text,2,1) = '2' then Binler:='İkiBin';
        if copy(sadeceytltext.text,2,1) = '3' then Binler:='ÜçBin';
        if copy(sadeceytltext.text,2,1) = '4' then Binler:='DörtBin';
        if copy(sadeceytltext.text,2,1) = '5' then Binler:='BeşBin';
        if copy(sadeceytltext.text,2,1) = '6' then Binler:='AltıBin';
        if copy(sadeceytltext.text,2,1) = '7' then Binler:='YediBin';
        if copy(sadeceytltext.text,2,1) = '8' then Binler:='SekizBin';
        if copy(sadeceytltext.text,2,1) = '9' then Binler:='DokuzBin';
        if copy(sadeceytltext.text,3,1) = '0' then Yuzler:='';
        if copy(sadeceytltext.text,3,1) = '1' then Yuzler:='Yüz';
        if copy(sadeceytltext.text,3,1) = '2' then Yuzler:='İkiYüz';
        if copy(sadeceytltext.text,3,1) = '3' then Yuzler:='ÜçYüz';
        if copy(sadeceytltext.text,3,1) = '4' then Yuzler:='DörtYüz';
        if copy(sadeceytltext.text,3,1) = '5' then Yuzler:='BeşYüz';
        if copy(sadeceytltext.text,3,1) = '6' then Yuzler:='AltıYüz';
        if copy(sadeceytltext.text,3,1) = '7' then Yuzler:='YediYüz';
        if copy(sadeceytltext.text,3,1) = '8' then Yuzler:='SekizYüz';
        if copy(sadeceytltext.text,3,1) = '9' then Yuzler:='DokuzYüz';
        if copy(sadeceytltext.text,4,1) = '0' then Onlar:='';
        if copy(sadeceytltext.text,4,1) = '1' then Onlar:='On';
        if copy(sadeceytltext.text,4,1) = '2' then Onlar:='Yirmi';
        if copy(sadeceytltext.text,4,1) = '3' then Onlar:='Otuz';
        if copy(sadeceytltext.text,4,1) = '4' then Onlar:='Kırk';
        if copy(sadeceytltext.text,4,1) = '5' then Onlar:='Elli';
        if copy(sadeceytltext.text,4,1) = '6' then Onlar:='Altmış';
        if copy(sadeceytltext.text,4,1) = '7' then Onlar:='Yetmiş';
        if copy(sadeceytltext.text,4,1) = '8' then Onlar:='Seksen';
        if copy(sadeceytltext.text,4,1) = '9' then Onlar:='Doksan';
        if copy(sadeceytltext.text,5,1) = '0' then Birler:='';
        if copy(sadeceytltext.text,5,1) = '1' then Birler:='Bir';
        if copy(sadeceytltext.text,5,1) = '2' then Birler:='İki';
        if copy(sadeceytltext.text,5,1) = '3' then Birler:='Üç';
        if copy(sadeceytltext.text,5,1) = '4' then Birler:='Dört';
        if copy(sadeceytltext.text,5,1) = '5' then Birler:='Beş';
        if copy(sadeceytltext.text,5,1) = '6' then Birler:='Altı';
        if copy(sadeceytltext.text,5,1) = '7' then Birler:='Yedi';
        if copy(sadeceytltext.text,5,1) = '8' then Birler:='Sekiz';
        if copy(sadeceytltext.text,5,1) = '9' then Birler:='Dokuz';

        if copy(yKrs,1,1) = '0' then yKrs_bir:='';
        if copy(yKrs,1,1) = '1' then yKrs_bir:='On';
        if copy(yKrs,1,1) = '2' then yKrs_bir:='Yirmi';
        if copy(yKrs,1,1) = '3' then yKrs_bir:='Otuz';
        if copy(yKrs,1,1) = '4' then yKrs_bir:='Kırk';
        if copy(yKrs,1,1) = '5' then yKrs_bir:='Elli';
        if copy(yKrs,1,1) = '6' then yKrs_bir:='Altmış';
        if copy(yKrs,1,1) = '7' then yKrs_bir:='Yetmiş';
        if copy(yKrs,1,1) = '8' then yKrs_bir:='Seksen';
        if copy(yKrs,1,1) = '9' then yKrs_bir:='Doksan';
        if copy(yKrs,2,1) = '0' then yKrs_iki:='';
        if copy(yKrs,2,1) = '1' then yKrs_iki:='Bir';
        if copy(yKrs,2,1) = '2' then yKrs_iki:='İki';
        if copy(yKrs,2,1) = '3' then yKrs_iki:='Üç';
        if copy(yKrs,2,1) = '4' then yKrs_iki:='Dört';
        if copy(yKrs,2,1) = '5' then yKrs_iki:='Beş';
        if copy(yKrs,2,1) = '6' then yKrs_iki:='Altı';
        if copy(yKrs,2,1) = '7' then yKrs_iki:='Yedi';
        if copy(yKrs,2,1) = '8' then yKrs_iki:='Sekiz';
        if copy(yKrs,2,1) = '9' then yKrs_iki:='Dokuz';
        edit1.text:=OnBinler+Binler+Yuzler+Onlar+Birler+' Lira '+yKrs_bir+yKrs_iki+' Kuruş';
end;

if length(sadeceytltext.text) = 6 then begin
        if copy(sadeceytltext.text,1,1) = '0' then YuzBinler:='';
        if copy(sadeceytltext.text,1,1) = '1' then YuzBinler:='Yüz';
        if copy(sadeceytltext.text,1,1) = '2' then YuzBinler:='İkiYüz';
        if copy(sadeceytltext.text,1,1) = '3' then YuzBinler:='ÜçYüz';
        if copy(sadeceytltext.text,1,1) = '4' then YuzBinler:='DörtYüz';
        if copy(sadeceytltext.text,1,1) = '5' then YuzBinler:='BeşYüz';
        if copy(sadeceytltext.text,1,1) = '6' then YuzBinler:='AltıYüz';
        if copy(sadeceytltext.text,1,1) = '7' then YuzBinler:='YediYüz';
        if copy(sadeceytltext.text,1,1) = '8' then YuzBinler:='SekizYüz';
        if copy(sadeceytltext.text,1,1) = '9' then YuzBinler:='DokuzYüz';
        if copy(sadeceytltext.text,2,1) = '0' then OnBinler:='';
        if copy(sadeceytltext.text,2,1) = '1' then OnBinler:='On';
        if copy(sadeceytltext.text,2,1) = '2' then OnBinler:='Yirmi';
        if copy(sadeceytltext.text,2,1) = '3' then OnBinler:='Otuz';
        if copy(sadeceytltext.text,2,1) = '4' then OnBinler:='Kırk';
        if copy(sadeceytltext.text,2,1) = '5' then OnBinler:='Elli';
        if copy(sadeceytltext.text,2,1) = '6' then OnBinler:='Altmış';
        if copy(sadeceytltext.text,2,1) = '7' then OnBinler:='Yetmiş';
        if copy(sadeceytltext.text,2,1) = '8' then OnBinler:='Seksen';
        if copy(sadeceytltext.text,2,1) = '9' then OnBinler:='Doksan';
        if copy(sadeceytltext.text,3,1) = '0' then Binler:='Bin';
        if copy(sadeceytltext.text,3,1) = '1' then Binler:='BirBin';
        if copy(sadeceytltext.text,3,1) = '2' then Binler:='İkiBin';
        if copy(sadeceytltext.text,3,1) = '3' then Binler:='ÜçBin';
        if copy(sadeceytltext.text,3,1) = '4' then Binler:='DörtBin';
        if copy(sadeceytltext.text,3,1) = '5' then Binler:='BeşBin';
        if copy(sadeceytltext.text,3,1) = '6' then Binler:='AltıBin';
        if copy(sadeceytltext.text,3,1) = '7' then Binler:='YediBin';
        if copy(sadeceytltext.text,3,1) = '8' then Binler:='SekizBin';
        if copy(sadeceytltext.text,3,1) = '9' then Binler:='DokuzBin';
        if copy(sadeceytltext.text,4,1) = '0' then Yuzler:='';
        if copy(sadeceytltext.text,4,1) = '1' then Yuzler:='Yüz';
        if copy(sadeceytltext.text,4,1) = '2' then Yuzler:='İkiYüz';
        if copy(sadeceytltext.text,4,1) = '3' then Yuzler:='ÜçYüz';
        if copy(sadeceytltext.text,4,1) = '4' then Yuzler:='DörtYüz';
        if copy(sadeceytltext.text,4,1) = '5' then Yuzler:='BeşYüz';
        if copy(sadeceytltext.text,4,1) = '6' then Yuzler:='AltıYüz';
        if copy(sadeceytltext.text,4,1) = '7' then Yuzler:='YediYüz';
        if copy(sadeceytltext.text,4,1) = '8' then Yuzler:='SekizYüz';
        if copy(sadeceytltext.text,4,1) = '9' then Yuzler:='DokuzYüz';
        if copy(sadeceytltext.text,5,1) = '0' then Onlar:='';
        if copy(sadeceytltext.text,5,1) = '1' then Onlar:='On';
        if copy(sadeceytltext.text,5,1) = '2' then Onlar:='Yirmi';
        if copy(sadeceytltext.text,5,1) = '3' then Onlar:='Otuz';
        if copy(sadeceytltext.text,5,1) = '4' then Onlar:='Kırk';
        if copy(sadeceytltext.text,5,1) = '5' then Onlar:='Elli';
        if copy(sadeceytltext.text,5,1) = '6' then Onlar:='Altmış';
        if copy(sadeceytltext.text,5,1) = '7' then Onlar:='Yetmiş';
        if copy(sadeceytltext.text,5,1) = '8' then Onlar:='Seksen';
        if copy(sadeceytltext.text,5,1) = '9' then Onlar:='Doksan';
        if copy(sadeceytltext.text,6,1) = '0' then Birler:='';
        if copy(sadeceytltext.text,6,1) = '1' then Birler:='Bir';
        if copy(sadeceytltext.text,6,1) = '2' then Birler:='İki';
        if copy(sadeceytltext.text,6,1) = '3' then Birler:='Üç';
        if copy(sadeceytltext.text,6,1) = '4' then Birler:='Dört';
        if copy(sadeceytltext.text,6,1) = '5' then Birler:='Beş';
        if copy(sadeceytltext.text,6,1) = '6' then Birler:='Altı';
        if copy(sadeceytltext.text,6,1) = '7' then Birler:='Yedi';
        if copy(sadeceytltext.text,6,1) = '8' then Birler:='Sekiz';
        if copy(sadeceytltext.text,6,1) = '9' then Birler:='Dokuz';

        if copy(yKrs,1,1) = '0' then yKrs_bir:='';
        if copy(yKrs,1,1) = '1' then yKrs_bir:='On';
        if copy(yKrs,1,1) = '2' then yKrs_bir:='Yirmi';
        if copy(yKrs,1,1) = '3' then yKrs_bir:='Otuz';
        if copy(yKrs,1,1) = '4' then yKrs_bir:='Kırk';
        if copy(yKrs,1,1) = '5' then yKrs_bir:='Elli';
        if copy(yKrs,1,1) = '6' then yKrs_bir:='Altmış';
        if copy(yKrs,1,1) = '7' then yKrs_bir:='Yetmiş';
        if copy(yKrs,1,1) = '8' then yKrs_bir:='Seksen';
        if copy(yKrs,1,1) = '9' then yKrs_bir:='Doksan';
        if copy(yKrs,2,1) = '0' then yKrs_iki:='';
        if copy(yKrs,2,1) = '1' then yKrs_iki:='Bir';
        if copy(yKrs,2,1) = '2' then yKrs_iki:='İki';
        if copy(yKrs,2,1) = '3' then yKrs_iki:='Üç';
        if copy(yKrs,2,1) = '4' then yKrs_iki:='Dört';
        if copy(yKrs,2,1) = '5' then yKrs_iki:='Beş';
        if copy(yKrs,2,1) = '6' then yKrs_iki:='Altı';
        if copy(yKrs,2,1) = '7' then yKrs_iki:='Yedi';
        if copy(yKrs,2,1) = '8' then yKrs_iki:='Sekiz';
        if copy(yKrs,2,1) = '9' then yKrs_iki:='Dokuz';
        edit1.text:=YuzBinler+OnBinler+Binler+Yuzler+Onlar+Birler+' Lira '+yKrs_bir+yKrs_iki+' Kuruş';
end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
memo1.Lines.Clear;
memo1.lines.add('ykrs_arti_bir: '+inttostr(ykrs_arti_bir));
memo1.lines.add('say: '+inttostr(say));
memo1.lines.add('---yukarisi integer---');
memo1.lines.add('yuvarlatilmis: '+yuvarlatilmis);
memo1.lines.add('sadeceyTL: '+sadeceyTL);
memo1.lines.add('YTL: '+YTL);
memo1.lines.add('YKrs: '+YKrs);
memo1.lines.add('yKrs_bir: '+yKrs_bir);
memo1.lines.add('yKrs_iki: '+yKrs_iki);
memo1.lines.add('birler: '+birler);
memo1.lines.add('onlar: '+onlar);
memo1.lines.add('yuzler: '+yuzler);
memo1.lines.add('binler: '+binler);
memo1.lines.add('onbinler: '+onbinler);
memo1.lines.add('yuzbinler: '+yuzbinler);
end;

end.
En son webaytek tarafından 15 Şub 2006 01:18 tarihinde düzenlendi, toplamda 1 kere düzenlendi.
ertug
Üye
Mesajlar: 82
Kayıt: 10 Ara 2004 05:41

Mesaj gönderen ertug »

@webaytek
Sorununuzun ne olduğunu tam anlayamadım ama galiba yeni kuruş hanesini 1 arttırmak istiyorsunuz.

'1.00' string değerini string '1.01' yapmak için:

Kod: Tümünü seç

var
  strLira: String;
  curLira: Currency;
begin
  strLira := '1,00'; //veya '1.00'; işletim sisteminin sayı formatına göre
  curLira := StrToCurr(strLira);
  strLira := CurrToStr(curLira + 0.01);
  ShowMessage(strLira);
end;
Yukarıdaki kodu '1.99' giriş değeriyle yazarsanız sonuç olarak '2' alırsınız. Eğer '2.00' değeri almak istiyorsanız:

Kod: Tümünü seç

CurrToStrF(curLira, ffNumber, 2);
'2.00 TL' veya '2.00 YTL' değeri almak istiyorsanız

Kod: Tümünü seç

CurrToStrF(curLira, ffCurrency, 2); 
@ademiz

Kod: Tümünü seç

14-     gun := FloatToStr(Date - DateTimePicker1.Date);
15-     okunan := cont * StrToInt(gun); 
Yaptığınız şeyler:
14- reel sayıyı yazıya çevirmek: örneğin 12.345
15- önceki yazıyı tam sayıya çevirmek. '12.345' tam sayıya çevrilemez, ki bu noktada delphi de aynı şeyi söylüyor. Yapmanız gereken 12'den sonraki kısmı kesmek.

Kod: Tümünü seç

14- //siliniz 
15- okunan := cont * Trunc(Date - DateTimePicker1.Date);
Ertuğ Kaya
Kullanıcı avatarı
webaytek
Üye
Mesajlar: 377
Kayıt: 23 Haz 2004 10:58

Mesaj gönderen webaytek »

@ertug kardeşim istediğim buydu işte çok saolasın... - HERKEZE KOLAY GELSİN :)
Cevapla