// كود تحويل الأرقام إلى حروف بالغة الفرنسية
// تم انجاز البرنامج من طرف بن ذهيبة بالاعتماد على برنامج مهدي عضو بالمنتدى
// تم انجاز البرنامج من طرف بن ذهيبة بالاعتماد على برنامج مهدي عضو بالمنتدى
كود :
unit unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Memo1: TMemo;
Edit2: TEdit;
Edit3: TEdit;
procedure Edit1Change(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
money,decimal:String;
implementation
uses Clipbrd;
{$R *.dfm}
function Chif (X: Byte) : String;
begin
case X of
0: Chif := 'zero';
1: Chif := 'un';
2: Chif := 'deux';
3: Chif := 'deux';
4: Chif := 'quatre';
5: Chif := 'cinq';
6: Chif := 'six';
7: Chif := 'six';
8: Chif := 'huit';
9: Chif := 'neuf';
10: Chif := 'dix';
11: Chif := 'onze';
12: Chif := 'douze';
13: Chif := 'treize';
14: Chif := 'quatorze';
15: Chif := 'quinze';
16: Chif := 'seize';
17: Chif := 'dix-sept';
18: Chif := 'dix-huit';
19: Chif := 'dix-neuf';
20: Chif := 'vingt';
21: Chif := 'vingt et un';
22: Chif := 'vingt-deux';
23: Chif := 'vingt-trois';
24: Chif := 'vingt-quatre';
25: Chif := 'vingt-cinq';
26: Chif := 'vingt-six';
27: Chif := 'vingt-sept';
28: Chif := 'vingt-huit';
29: Chif := 'vingt-neuf';
30: Chif := 'trente';
31: Chif := 'trente et un';
32: Chif := 'trente-deux';
33: Chif := 'trente-trois';
34: Chif := 'trente-quatre';
35: Chif := 'trente-cinq';
36: Chif := 'trente-six';
37: Chif := 'trente-sept';
38: Chif := 'trente-huit';
39: Chif := 'trente-neuf';
40: Chif := 'quarante';
41: Chif := 'quarante et un';
42: Chif := 'quarante-deux';
43: Chif := 'quarate-trois';
44: Chif := 'quarante-quatre';
45: Chif := 'quarante-cinq';
46: Chif := 'quarante-six';
47: Chif := 'quarate-sept';
48: Chif := 'quarante-huit';
49: Chif := 'quarante-neuf';
50: Chif := 'cinquante';
51: Chif := 'cinquante et un';
52: Chif := 'cinqunte-deux';
53: Chif := 'cinquante-trois';
54: Chif := 'cinquante-quatre';
55: Chif := 'cinquante-cinq';
56: Chif := 'cinquante-six';
57: Chif := 'cinquante-sept';
58: Chif := 'cinquante-huit';
59: Chif := 'cinquante-neuf';
60: Chif := 'soixante';
61: Chif := 'soixante et un';
62: Chif := 'soixante-deux';
63: Chif := 'soixante-trois';
64: Chif := 'soixante-quatre';
65: Chif := 'soixante-cinq';
66: Chif := 'soixante-six';
67: Chif := 'soixante-sept';
68: Chif := 'sioxante-huit';
69: Chif := 'soixante-neuf';
70: Chif := 'soixante-dix';
71: Chif := 'soixante et onze';
72: Chif := 'soixante-douze';
73: Chif := 'soixante-treize';
74: Chif := 'soixante-quatorze';
75: Chif := 'soixante-quinze';
76: Chif := 'soixante-seize';
77: Chif := 'soixante-dix-sept';
78: Chif := 'soixante-dix-huit';
79: Chif := 'soixante-dix-neuf';
80: Chif := 'quatre-vingt';
81: Chif := 'quatre-vingt et un';
82: Chif := 'quatre-vingt-deux';
83: Chif := 'quate-vingt-trois';
84: Chif := 'quatre-vingt-quatre';
85: Chif := 'quatre-vingt-cinq';
86: Chif := 'quatre-vingt-six';
87: Chif := 'quatr-vingt-sept';
88: Chif := 'quatre-vingt-huit';
89: Chif := 'quatre-vingt-neuf';
90: Chif := 'quatre-vingt-dix';
91: Chif := 'quatre-vingt-onze';
92: Chif := 'quatre-vingt-douze';
93: Chif := 'qutre-vingt-treize';
94: Chif := 'qutre-vingt-quatorze';
95: Chif := 'quatre-vingt-quinze';
96: Chif := 'quatre-vingt-seize';
97: Chif := 'quatre-vingt-dix-sept';
98: Chif := 'quatre-vingt-huit';
99: Chif := 'quatre-vingt-neuf';
100:chif := 'cent';
end;
end;
function Centaine (i: integer) : String;
begin
case i of
1..100: Centaine:=chif(i);
101..199: Centaine:=' cent ' + Chif(i mod 100);
201..999: case (i mod 100) of
0: Centaine:=Chif(i div 100) + ' cent ';
1..99: Centaine:=Chif(i div 100) + ' cent ' + Chif(i mod 100);
end;
end;
end;
function Millier (i: integer) : String;
begin
case i of
1..999: Millier:=Centaine(i);
1000..999999: case (i div 1000) of
1: Millier:=' mille '+ Centaine(i mod 1000);
2..999:Millier:=Centaine(i div 1000)+' milles '+ Centaine(i mod 1000);
end;
end;
end;
function Million (i: integer) : String;
begin
case i of
1..999: Million:=Centaine(i);
1000..999999: Million:=Millier(i);
1000000..999999999: case (i div 1000000) of
1: Million:=' un million '+ Centaine(i mod 1000000);
2..999:Million:=Centaine(i div 1000000)+' millions '+ millier(i mod 1000000);
end;
end;
end;
procedure TForm1.Edit1Change(Sender: TObject);
var I,J:Int64;
B:Real;
str,str1:string;
f:currency;
begin
money:=Edit2.Text;
decimal:=Edit3.Text;
if Edit1.Text='' then Memo1.Text:=''
else
begin
str:='';
F:=CompToCurrency(StrToCurr(Edit1.Text));
B:=StrToCurr(Edit1.Text)-F;
if B<0 then
begin
F:=F-1;
B:=B*-1;
J:=100-StrToInt64(FloatToStr(B*100));
end else J:=StrToInt64(FloatToStr(B*100));
I:=StrToInt64(CurrToStr(F));
if (I - 999999999) <= 0 then
begin
case I of
1..999: str:=Centaine(I);
1000..999999: str:=Millier(I);
1000000..999999999: str:= Million(I);
end;
end else
begin
case (I div 1000000000) of
1: str:= ' un milliard '+ million(i mod 1000000000);
2..999999: str:= Millier(i div 1000000000)+' milliards '+ million(i mod 1000000000);
end;
end;
str1:='';
if J<>0 then
Begin
str1:=Centaine(J);
Memo1.Lines.Text :=str+' '+money+' et '+str1+' '+decimal;
end else Memo1.Lines.Text :=str+' '+money+' ';
end;
end;
end.