English
Source / code snippets

Dezimalzahl Konverter Roem2arab Römische Zahlzeichen

 

Michael
Wodrich

CompileMarkSeparation
!
Roem2Arab - Wandelt Römische Zahlzeichen in eine Dezimalzahl.
siehe auch: Arab2Roem$
Die Rückwandlung ist eigentlich ganz einfach wenn man sich
am anderen Code orientiert.
Aber Vorsicht!!
Hier finden keinerlei Fehlerprüfungen statt.
-------------------------------------------------------

Proc Roem2Arab

    Parameters Roem$
    Declare Erg&

    While Left$(Roem$,1)="M"  : Add Erg&,1000 : Roem$ = Right$(Roem$,Len(Roem$) - 1) : EndWhile

        If    Left$(Roem$,2)="CM" : Add Erg&, 900 : Roem$ = Right$(Roem$,Len(Roem$) - 2) : EndIf

            If    Left$(Roem$,1)="D"  : Add Erg&, 500 : Roem$ = Right$(Roem$,Len(Roem$) - 1) : EndIf

                If    Left$(Roem$,2)="CD" : Add Erg&, 400 : Roem$ = Right$(Roem$,Len(Roem$) - 2) : EndIf

                    While Left$(Roem$,1)="C"  : Add Erg&, 100 : Roem$ = Right$(Roem$,Len(Roem$) - 1) : EndWhile

                        If    Left$(Roem$,2)="XC" : Add Erg&,  90 : Roem$ = Right$(Roem$,Len(Roem$) - 2) : EndIf

                            If    Left$(Roem$,1)="L"  : Add Erg&,  50 : Roem$ = Right$(Roem$,Len(Roem$) - 1) : EndIf

                                If    Left$(Roem$,2)="XL" : Add Erg&,  40 : Roem$ = Right$(Roem$,Len(Roem$) - 2) : EndIf

                                    While Left$(Roem$,1)="X"  : Add Erg&,  10 : Roem$ = Right$(Roem$,Len(Roem$) - 1) : EndWhile

                                        If    Left$(Roem$,2)="IX" : Add Erg&,   9 : Roem$ = Right$(Roem$,Len(Roem$) - 2) : EndIf

                                            If    Left$(Roem$,1)="V"  : Add Erg&,   5 : Roem$ = Right$(Roem$,Len(Roem$) - 1) : EndIf

                                                If    Left$(Roem$,2)="IV" : Add Erg&,   4 : Roem$ = Right$(Roem$,Len(Roem$) - 2) : EndIf

                                                    While Left$(Roem$,1)="I"  : Add Erg&,   1 : Roem$ = Right$(Roem$,Len(Roem$) - 1) : EndWhile

                                                        Return Erg&

                                                    EndProc

                                                    Cls
                                                    print "römische Zahlzeichen zurückwandeln:"
                                                    print "    7 -> VII      ->",Roem2Arab("VII")
                                                    print "   84 -> LXXXIV   ->",Roem2Arab("LXXXIV")
                                                    print " 1932 -> MCMXXXII ->",Roem2Arab("MCMXXXII")
                                                    print " 2006 -> MMVI     ->",Roem2Arab("MMVI")
                                                    WaitKey
                                                    /../function-references/XProfan/end/'>End
 
Programmieren, das spannendste Detektivspiel der Welt.
12/14/05  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.160 Views

Untitledvor 0 min.
E.T.01/14/24
RudiB.04/01/20
iF06/01/13
Julian Schmidt10/08/11

Themeninformationen

this Topic has 1 subscriber:

Michael Wodrich (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie