![]() |
easy roman numerals
could someone make this program actually do roman numerals.
Dim a As Integer Dim b As Integer Dim Digit As Integer Dim RomanNumber As String Dim RomanDigit As String Roman = InputBox("Type in number", "Numerals", "X") a = Len(Roman) RomanNumber = Roman RomanNumber = UCase(RomanNumber) For b = a To 1 Step -1 RomanDigit = Mid$(RomanNumber, b, 1) Select Case RomanDigit Case "L" Digit = 50 Case "C" Digit = 100 Case "D" Digit = 500 Case "M" Digit = 1000 Case "X" Digit = 10 Case "I" Digit = 1 Case "V" Digit = 5 Case Else MsgBox ("Invalid Character") End Select firstnumeral = Digit secondnumeral = secondnumeral + firstnumeral If secondnumeral > firstnumeral Then secondnumeral = secondnumeral - First End If Next MsgBox "Numeral " & secondnumeral |
Yeah... what language?
in java: Code:
private static String RN(int number){ |
The three methods are for turning a base 10 number into a Roman numeral, a Roman numeral into a base 10 number, and a method for the second method to find the value of an individual character.
I decided to test it and the first and third methods run completely fine, however the second method won't work properly... Can anyone figure out the flaw? EDIT: Nevermind; I fixed it. I was going recursion-happy I think. Class has been affecting me I think with it influencing the way I program. :sick: |
no, i think justin wants it in visual basic 6?
|
| All times are GMT -5. The time now is 08:15 PM. |
Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.