1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
| uses crt,dos;
var
a:integer;
s:string;
write('Entrer votre chiffre');
read(s);
val(s,g);
case s[1] of
'0':write('zero');
function tran(unite:integer):string;
begin
if s[1]=1 then tran:='un';
if s[1]=2 then tran:='deux';
if s[1]=3 then tran:='trois';
if s[1]=4 then tran:='quatre';
if s[1]=5 then tran:='cinq';
if s[1]=6 then tran:='six';
if s[1]=7 then tran:='sept';
if s[1]=8 then tran:='huit';
if s[1]=9 then tran:='neuf';
end;
function tran(dizaine:integer):string;
begin
if s[1]=0 then tran:='dix';
if s[1]=1 then tran:='onze';
if s[1]=2 then tran:='douze';
if s[1]=3 then tran:='treize';
if s[1]=4 then tran:='quartoze';
if s[1]=5 then tran:='quinze';
if s[1]=6 then tran:='seize';
if s[1]=7 then tran:='dix-sept';
if s[1]=8 then tran:='dix-huit';
if s[1]=9 then tran:='dix-neuf';
end;
function tran(a:integer):string;
begin
if s[2]=0 then tran:=' ';
if s[2]=1 then tran:='et un';
if s[2]=2 then tran:='deux';
if s[2]=3 then tran:='trois';
if s[2]=4 then tran:='quatre';
if s[2]=5 then tran:='cinq';
if s[2]=6 then tran:='six';
if s[2]=7 then tran:='sept';
if s[2]=8 then tran:='huit';
if s[2]=9 then tran:='neuf';
end;
function tran(b:integer):string;
begin
if s[1]=0 then tran:='dix';
if s[1]=1 then tran:='et onze';
if s[1]=2 then tran:='douze';
if s[1]=3 then tran:='treize';
if s[1]=4 then tran:='quartoze';
if s[1]=5 then tran:='quinze';
if s[1]=6 then tran:='seize';
if s[1]=7 then tran:='dix-sept';
if s[1]=8 then tran:='dix-huit';
if s[1]=9 then tran:='dix-neuf';
end;
function tran(c:integer):string;
begin
case s[1] of
'0':write(tran(unite));end;
'1';write(tran(dizaine));end;
'2':begin val(s[2],a);write('vingt ',tran(a));end;
'3':begin val(s[2],a);write('trente ',tran(a));end;
'4':begin val(s[2],a);write('quarante ',tran(a));end;
'5':begin val(s[2],a);write('cinquante ',tran(a));end;
'6':begin val(s[2],a);write('soixante ',tran(a));end;
'7':begin case s[2],b);write('soixante et 'tran(b);end;
'8':begin val(s[2],a);write('quatre vingt et ',tran(a));end;
'9':begin case s[2],b);write('quatre vingt 'tran(b);end;
end;
function tran(d:integer):string;
begin
case s[2] of
'0':write(tran(c));
'1':begin val(s[3],c);write('cent ',tran(c));end;
'2':begin val(s[3],c);write('deux cent ',tran(c));end;
'3':begin val(s[3],c);write('trois cent ',tran(c));end;
'4':begin val(s[3],c);write('quatre cent ',tran(c));end;
'5':begin val(s[3],c);write('cinq cent ',tran(c));end;
'6':begin val(s[3],c);write('six cent ',tran(c));end;
'7':begin val(s[3],c);write('sept cent ',tran(c));end;
'8':begin val(s[3],c);write('huit cent ',tran(c));end;
'9':begin val(s[3],c);write('neuf cent ',tran(c));end;
end;
function tran(e:integer):string;
case s[3] of
if s[4]=1 then tran:='mille';
if s[4]>1 or s[5]>=0 ou s[6]>=0 then write(tran(c), 'mille',tran(c));end;
end;
function tran(milliers:integer):string;
begin
if n< 1000000;
if n>1999 write(tran(c(s/1000);
if n>999 tran:='mille';
function tran(c(n - 1000(n/1000)));
end; |
Partager