Conversion en chiffres romains

Partagez votre expérience de PureBasic avec les autres utilisateurs.
Ollivier
Messages : 4190
Inscription : ven. 29/juin/2007 17:50
Localisation : Encore ?
Contact :

Re: Conversion en chiffres romains

Message par Ollivier »

Et hop... Réciproque : (merci à Flype et Beruska)

Code : Tout sélectionner

;*******************************************************************************************
Procedure Roman2Dec(R.S)
   Protected.S RP0 = "CM,M,CD,D,XC,C,XL,L,IX,X,IV,V,I", RP
   Repeat
      For J = 1 To 13
         RP = StringField(RP0, J, ",")
         If Right(Ucase(R), Len(RP) ) = RP
            N + Val(StringField("900,1000,400,500,90,100,40,50,9,10,4,5,1", J, ",") )
            R = Left(R, Len(R) - Len(RP) )
         EndIf
      Next
   Until R = ""
   ProcedureReturn N
EndProcedure
Avatar de l’utilisateur
Micoute
Messages : 2522
Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière

Re: Conversion en chiffres romains

Message par Micoute »

Merci pour le partage.
Microsoft Windows 10 Famille 64 bits : Carte mère : ASRock 970 Extreme3 R2.0 : Carte Graphique NVIDIA GeForce RTX 3080 : Processeur AMD FX 6300 6 cœurs 12 threads 3,50 GHz PB 5.73 PB 6.00 LTS (x64)
Un homme doit être poli, mais il doit aussi être libre !
Avatar de l’utilisateur
Flype
Messages : 2431
Inscription : jeu. 29/janv./2004 0:26
Localisation : Nantes

Re: Conversion en chiffres romains

Message par Flype »

:D
Image
Répondre