Conversor a Numeros Romanos

Desde que me he aficionado al pseudocodigo me salen los programas como churros, me he entretenido con un pseudocodigo que hacia la conversion de numeros normales a numeros romanos y esto es lo que me ha salido.
1º las imagenes y luego el codigo:



Es algo complicado el codigo, pero queda un programita muy utilizable, ahora os dejo el

CODIGO:
Private Sub Command1_Click()

    Dim num, col As Integer
    Label2.Caption = ""
    num = Val(Text1.Text)
If Text1.Text <> "" And IsNumeric(Text1.Text) = True And Val(Text1.Text) > 0 And Val(Text1.Text) <= 5000 Then
col = 15
'HAGO WHILE A WHILE PARA CONTROLAR MEJOR EL PROGRAMA
'con las correspondientes sangrias no hay error posible
    While num >= 1000
               Label2.Caption = Label2.Caption & "M"
               num = num - 1000
              col = col + 1
   Wend
   While num >= 900
              Label2.Caption = Label2.Caption & "CM"
              num = num - 900
              col = col + 2
  Wend
  While num >= 500
             Label2.Caption = Label2.Caption & "D"
             num = num - 500
             col = col + 1
  Wend
  While num >= 100
            Label2.Caption = Label2.Caption & "C"
           num = num - 100
           col = col + 1
  Wend
  While num >= 90
           Label2.Caption = Label2.Caption & "XC"
           num = num - 90
           col = col + 2
  Wend
  While num >= 50
           Label2.Caption = Label2.Caption & "L"
           num = num - 50
           col = col + 1
  Wend
  While num >= 40
          Label2.Caption = Label2.Caption & "XL"
          num = num - 40
          col = col + 2
  Wend
  While num >= 10
          Label2.Caption = Label2.Caption & "X"
          num = num - 10
          col = col + 1
  Wend
  While num >= 9
          Label2.Caption = Label2.Caption & "IX"
          num = num - 9
          col = col + 2
  Wend
  While num >= 5
          Label2.Caption = Label2.Caption & "V"
          num = num - 5
          col = col + 1
  Wend
  While num >= 4
          Label2.Caption = Label2.Caption & "IV"
          num = num - 4
          col = col + 2
  Wend
  While num > 0
          Label2.Caption = Label2.Caption & "I"
          num = num - 1
          col = col + 1
  Wend

Else
MsgBox "introduce un numero entre 0 y 5000", vbOKOnly, "Atencion"
Text1.Text = ""
Text1.SetFocus
End If
End Sub


No hay comentarios: