computer-mag
سه شنبه 30 بهمن 1386, 22:04 عصر
برنامه ای در این سایت پیدا کردم که عدد را به نوشتار تبدیل می کرد که برنامه رو در ادامه گذاشتم ولی چون برنامه از نوع int64 استفاده می کنه تا عدد 2 میلیارد و خوره ای را بیشتر نمی تونه تبدیل کنه در صورتی که برنامه تا تریلیون رو پضتیبانی می کنه می خواستم ببینم چجوری میشه برنامه را ظرقیتش را بالا برد یعنی حتی بیشتر از تریلیون!من اصلا چیزی در این باره و این کار نمی دونم اگه لطف کنید کد رو اصلاح کنید و بزارید فکر کنم این کد وقتی اصلاح بشه به درد همه برنامه نویسای دلفی بخوره!پیشاپیش ممنون
function Add2Harf(i:int64):string;
const v=' æ ';
var
ok:boolean;
{___________________________________}
function yekan(y:byte):string;
begin
case y of
0:result:='';
1:result:='íß';
2:result:='Ïæ';
3:result:='Óå';
4:result:='åÇÑ';
5:result:='äÌ';
6:result:='ÔÔ';
7:result:='åÝÊ';
8:result:='åÔÊ';
9:result:='äå';
enD;
if result=''then ok:=false else ok:=true;
end;
{___________________________________}
function dahgan(y:byte):string;
begin
case y of
0:result:='';
1:result:='Ïå';
2:result:='ÈíÓÊ';
3:result:='Óí';
4:result:='åá';
5:result:='äÌÇå';
6:result:='ÔÕÊ';
7:result:='åÝÊÇÏ';
8:result:='åÔÊÇÏ';
9:result:='äæÏ';
enD;
if result=''then ok:=false else ok:=true;
end;
{___________________________________}
function sadgan(y:byte):string;
begin
case y of
0:result:='';
1:result:='íßÕÏ';
2:result:='ÏæíÓÊ';
3:result:='ÓíÕÏ';
4:result:='åÇÑÕÏ';
5:result:='ÇäÕÏ';
6:result:='ÔÔÕÏ';
7:result:='åÝÊÕÏ';
8:result:='åÔÊÕÏ';
9:result:='äåÕÏ';
enD;
if result=''then ok:=false else ok:=true;
end;
{___________________________________}
function dah(y:byte):string;
begin
case y of
0:result:='';
10:result:='Ïå';
11:result:='íÇÒÏå';
12:result:='ÏæÇÒÏå';
13:result:='ÓíÒÏå';
14:result:='åÇÑÏå';
15:result:='ÇäÒÏå';
16:result:='ÔÇäÒÏå';
17:result:='åÝÏå';
18:result:='åÌÏå';
19:result:='äæÒÏå';
enD;
if result=''then ok:=false else ok:=true;
end;
{___________________________________}
function seragham(si:smallint):string;
begin
result:='';
result:=sadgan(si div 100);
if ok then result:=result+v;
if((si mod 100)div 10) <> 1 then begin
result:=result+dahgan((si mod 100)div 10);
if ok then result:=result+v;
result:=result+yekan(si mod 10);
if not ok then result:=copy(result,1,length(result)-3);
End
else begin
result:=result+dah(si mod 100);
end;
if result='' then ok:=false else ok:=true;
end;
{___________________________________}
const
tr=' ÊÑíáíæä';
mr=' ãíáíÇÑÏ';
ml=' ãíáíæä';
hz=' åÒÇÑ';
begin
ok:=false;
result:=seragham(i div 1000000000000);
if ok then result:=result+tr+v;
result:=result+seragham((i mod 1000000000000)div 1000000000);
if ok then result:=result+mr+v;
result:=result+seragham((i mod 1000000000)div 1000000);
if ok then result:=result+ml+v;
result:=result+seragham((i mod 1000000)div 1000);
if ok then result:=result+hz+v;
result:=result+seragham(i mod 1000);
if not ok then result:=copy(result,1,length(result)-3);
if i=0 then result:='ÕÝÑ';
end;
function Add2Harf(i:int64):string;
const v=' æ ';
var
ok:boolean;
{___________________________________}
function yekan(y:byte):string;
begin
case y of
0:result:='';
1:result:='íß';
2:result:='Ïæ';
3:result:='Óå';
4:result:='åÇÑ';
5:result:='äÌ';
6:result:='ÔÔ';
7:result:='åÝÊ';
8:result:='åÔÊ';
9:result:='äå';
enD;
if result=''then ok:=false else ok:=true;
end;
{___________________________________}
function dahgan(y:byte):string;
begin
case y of
0:result:='';
1:result:='Ïå';
2:result:='ÈíÓÊ';
3:result:='Óí';
4:result:='åá';
5:result:='äÌÇå';
6:result:='ÔÕÊ';
7:result:='åÝÊÇÏ';
8:result:='åÔÊÇÏ';
9:result:='äæÏ';
enD;
if result=''then ok:=false else ok:=true;
end;
{___________________________________}
function sadgan(y:byte):string;
begin
case y of
0:result:='';
1:result:='íßÕÏ';
2:result:='ÏæíÓÊ';
3:result:='ÓíÕÏ';
4:result:='åÇÑÕÏ';
5:result:='ÇäÕÏ';
6:result:='ÔÔÕÏ';
7:result:='åÝÊÕÏ';
8:result:='åÔÊÕÏ';
9:result:='äåÕÏ';
enD;
if result=''then ok:=false else ok:=true;
end;
{___________________________________}
function dah(y:byte):string;
begin
case y of
0:result:='';
10:result:='Ïå';
11:result:='íÇÒÏå';
12:result:='ÏæÇÒÏå';
13:result:='ÓíÒÏå';
14:result:='åÇÑÏå';
15:result:='ÇäÒÏå';
16:result:='ÔÇäÒÏå';
17:result:='åÝÏå';
18:result:='åÌÏå';
19:result:='äæÒÏå';
enD;
if result=''then ok:=false else ok:=true;
end;
{___________________________________}
function seragham(si:smallint):string;
begin
result:='';
result:=sadgan(si div 100);
if ok then result:=result+v;
if((si mod 100)div 10) <> 1 then begin
result:=result+dahgan((si mod 100)div 10);
if ok then result:=result+v;
result:=result+yekan(si mod 10);
if not ok then result:=copy(result,1,length(result)-3);
End
else begin
result:=result+dah(si mod 100);
end;
if result='' then ok:=false else ok:=true;
end;
{___________________________________}
const
tr=' ÊÑíáíæä';
mr=' ãíáíÇÑÏ';
ml=' ãíáíæä';
hz=' åÒÇÑ';
begin
ok:=false;
result:=seragham(i div 1000000000000);
if ok then result:=result+tr+v;
result:=result+seragham((i mod 1000000000000)div 1000000000);
if ok then result:=result+mr+v;
result:=result+seragham((i mod 1000000000)div 1000000);
if ok then result:=result+ml+v;
result:=result+seragham((i mod 1000000)div 1000);
if ok then result:=result+hz+v;
result:=result+seragham(i mod 1000);
if not ok then result:=copy(result,1,length(result)-3);
if i=0 then result:='ÕÝÑ';
end;