Rap
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Rap

Rap
 
AnasayfaLatest imagesAramaKayıt OlGiriş yap

 

 Roma rakamı

Aşağa gitmek 
YazarMesaj
The_SaS
Admin
Admin
The_SaS


Mesaj Sayısı : 67
Kayıt tarihi : 12/04/08
Nerden : ßir Köylü çocugu

Roma rakamı Empty
MesajKonu: Roma rakamı   Roma rakamı Icon_minitimeSalı Nis. 15, 2008 3:09 am

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, dxCntner, dxEditor, dxExEdtr, dxEdLib;

type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure Hesapla;
private
{ Private declarations }
girsay : Integer;
modu : Integer;
kalan : Integer;
bolen : Integer;
Sonuc : String;
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Hesapla;
begin
kalan := girsay mod bolen;
modu := girsay div bolen;
while modu > 0 do
if bolen=1000 then
begin
Sonuc := Sonuc+'M';
dec(modu) //modu := modu-1;
end else
if bolen=900 then
begin
Sonuc := Sonuc+'CM';
dec(modu)
end else
if bolen=500 then
begin
Sonuc := Sonuc+'D';
dec(modu)
end else
if bolen=400 then
begin
Sonuc := Sonuc+'CD';
dec(modu)
end else
if bolen=100 then
begin
Sonuc := Sonuc+'C';
dec(modu)
end else
if bolen=90 then
begin
Sonuc := Sonuc+'XC';
dec(modu)
end else
if bolen=50 then
begin
Sonuc := Sonuc+'L';
dec(modu)
end else
if bolen=40 then
begin
Sonuc := Sonuc+'XL';
dec(modu)
end else
if bolen=10 then
begin
Sonuc := Sonuc+'X';
dec(modu)
end else
if bolen=9 then
begin
Sonuc := Sonuc+'IX';
dec(modu)
end else
if bolen=5 then
begin
Sonuc := Sonuc+'V';
dec(modu)
end else
if bolen=4 then
begin
Sonuc := Sonuc+'IV';
dec(modu)
end else
if bolen=1 then
begin
Sonuc := Sonuc+'I';
dec(modu)
end;
case bolen of
1 : bolen := 0;
4 : bolen := 1;
5 : bolen := 4;
9 : bolen := 5;
10 : bolen := 9;
40 : bolen := 10;
50 : bolen := 40;
90 : bolen := 50;
100 : bolen := 90;
400 : bolen := 100;
500 : bolen := 400;
900 : bolen := 500;
1000: bolen := 900;
end;
girsay := kalan;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
Sonuc := '';
bolen := 1000;
girsay :=StrToInt(Trim(Edit1.Text));
while bolen > 0 do
Hesapla;
Label1.Caption :=Sonuc;
Edit1.SetFocus;
end;

end.;
Sayfa başına dön Aşağa gitmek
https://sistem.yetkin-forum.com
 
Roma rakamı
Sayfa başına dön 
1 sayfadaki 1 sayfası

Bu forumun müsaadesi var:Bu forumdaki mesajlara cevap veremezsiniz
Rap :: C/C++ & Delphi-
Buraya geçin: