Décimale en chiffres romains


Cet article explique comment convertir un nombre en Chiffres Romains dans Delphi.
fonction de DecToRoman ( iDecimal: longint ): string
const
& nbsp & nbsp aRomans: array [ 1..13 ] of string = ( 'I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'CROSS', 'C', 'CD', 'D', 'CM', 'M' )
& nbsp & nbsp aArabics: tableau [ 1..13 ] of integer = ( 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000 )
var
& nbsp & nbsp & nbsp i: integer
begin
& nbsp & nbsp résultat := '
& nbsp & nbsp for i := 13 downto 1 do
& ! & ! & ! & nbsp while ( iDecimal >= aArabics [ i ] ) do begin
& ! & ! & ! & ! & ! & nbsp iDecimal := iDecimal - aArabics [ i ]
& ! & ! & ! & ! & ! & nbsp result := result aRomans [ i ]
& ! & ! & ! & nbsp fin
fin









Decimale en chiffres romains


Decimale en chiffres romains : Plusieurs milliers de conseils pour vous faciliter la vie.


Cet article explique comment convertir un nombre en Chiffres Romains dans Delphi.
fonction de DecToRoman ( iDecimal: longint ): string
const
& nbsp & nbsp aRomans: array [ 1..13 ] of string = ( 'I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'CROSS', 'C', 'CD', 'D', 'CM', 'M' )
& nbsp & nbsp aArabics: tableau [ 1..13 ] of integer = ( 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000 )
var
& nbsp & nbsp & nbsp i: integer
begin
& nbsp & nbsp resultat := '
& nbsp & nbsp for i := 13 downto 1 do
& ! & ! & ! & nbsp while ( iDecimal >= aArabics [ i ] ) do begin
& ! & ! & ! & ! & ! & nbsp iDecimal := iDecimal - aArabics [ i ]
& ! & ! & ! & ! & ! & nbsp result := result aRomans [ i ]
& ! & ! & ! & nbsp fin
fin


Décimale en chiffres romains

Décimale en chiffres romains : Plusieurs milliers de conseils pour vous faciliter la vie.
Recommander aux amis
  • gplus
  • pinterest

Messages récents

Commentaire

Laisser un commentaire

évaluation