Visualizzazione dei risultati da 1 a 7 su 7

Discussione: Data in numeri romani

  1. #1
    Utente di HTML.it
    Registrato dal
    Apr 2004
    Messaggi
    60

    Data in numeri romani

    Salve a tutti, mi servirebbe la data in numeri romani, non so' da dove cominciare, il tutto in asp qualcuno se in grado puo' aiutarmi? grazie.

  2. #2

  3. #3
    Utente di HTML.it
    Registrato dal
    Apr 2004
    Messaggi
    60
    esattamente

  4. #4
    WOW! Un bel esercizio.

  5. #5
    codice:
    <%
      anno = 1563
    
      romano = ""
    
      for i = 1 to anno\1000
          romano = romano&"M"
      next
    
      anno = anno mod 1000
    
      for i = 1 to anno\100
          if anno\100 > 5 and anno\100 < 9 then
             romano = romano & "D"
             anno = anno - 500
          elseif anno\100 > 0 and anno\100 < 4 then
             romano = romano & "C"
             anno = anno - 100
          elseif anno\100 = 9 then
             romano = romano & "CM"
             Exit For
          elseif anno\100 = 4 then
             romano = romano & "CD"
             Exit For
          elseif anno\100 = 10 then
             romano = romano & "M"
             Exit For
          elseif anno\100 = 5 then
             romano = romano & "D"
             Exit For
          end if
      next
    
      anno = anno mod 100
    
      for i = 1 to anno\10
          if anno\10 > 5 and anno\10 < 9 then
             romano = romano & "L"
             anno = anno - 50
          elseif anno\10 > 0 and anno\10 < 4 then
             romano = romano & "X"
             anno = anno - 10
          elseif anno\10 = 9 then
             romano = romano & "XC"
             Exit For
          elseif anno\10 = 4 then
             romano = romano & "XL"
             Exit For
          elseif anno\100 = 4 then
             romano = romano & "C"
             Exit For
          elseif anno\100 = 4 then
             romano = romano & "L"
             Exit For
          end if
      next
    
      anno = anno mod 10
    
      for i = 1 to anno
          if anno > 5 and anno < 9 then
             romano = romano & "V"
             anno = anno - 5
          elseif anno > 0 and anno < 4 then
             romano = romano & "I"
             anno = anno - 1
          elseif anno = 9 then
             romano = romano & "IX"
             Exit For
          elseif anno = 4 then
             romano = romano & "IV"
             Exit For
          elseif anno = 4 then
             romano = romano & "X"
             Exit For
          elseif anno = 4 then
             romano = romano & "V"
             Exit For
          end if
      next
    
      response.write "data=  "&romano
    %>
    a me così funziona...ho provato con un po' di date...
    dimmi se ti va...
    Purtroppo bisogna imparare che il computer non sbaglia...fa solo quello che gli dici di fare

    www.netpolaris.it

  6. #6
    Utente di HTML.it
    Registrato dal
    Apr 2004
    Messaggi
    60
    Bene grazie appena nel progetto arrivo in quel punto la provo e ti avviso se va'.
    Intanto Grazie!!

  7. #7
    codice:
    <%
      anno = 1956
    
      mille = "M"
      cinquecento = "D"
      cento = "C"
      cinquanta = "L"
      dieci = "X"
      cinque = "V"
      uno = "I"
    
      romano = ""
    
      for i = 1 to anno\1000
          romano = romano&"M"
      next
    
      anno = anno mod 1000
    
      for i = 1 to anno\100
          if anno\100 > 5 and anno\100 < 9 then
             romano = romano & "D"
             anno = anno - 500
          elseif anno\100 > 0 and anno\100 < 4 then
             romano = romano & "C"
             anno = anno - 100
          elseif anno\100 = 9 then
             romano = romano & "CM"
             Exit For
          elseif anno\100 = 4 then
             romano = romano & "CD"
             Exit For
          elseif anno\100 = 10 then
             romano = romano & "M"
             Exit For
          elseif anno\100 = 5 then
             romano = romano & "D"
             Exit For
          end if
      next
    
      anno = anno mod 100
    
      for i = 1 to anno\10
          if anno\10 > 5 and anno\10 < 9 then
             romano = romano & "L"
             anno = anno - 50
          elseif anno\10 > 0 and anno\10 < 4 then
             romano = romano & "X"
             anno = anno - 10
          elseif anno\10 = 9 then
             romano = romano & "XC"
             Exit For
          elseif anno\10 = 4 then
             romano = romano & "XL"
             Exit For
          elseif anno\10 = 10 then
             romano = romano & "C"
             Exit For
          elseif anno\10 = 5 then
             romano = romano & "L"
             Exit For
          end if
      next
    
      anno = anno mod 10
    
      for i = 1 to anno
          if anno > 5 and anno < 9 then
             romano = romano & "V"
             anno = anno - 5
          elseif anno > 0 and anno < 4 then
             romano = romano & "I"
             anno = anno - 1
          elseif anno = 9 then
             romano = romano & "IX"
             Exit For
          elseif anno = 4 then
             romano = romano & "IV"
             Exit For
          elseif anno = 10 then
             romano = romano & "X"
             Exit For
          elseif anno = 5 then
             romano = romano & "V"
             Exit For
          end if
      next
    
      response.write "data=  "&romano
    %>
    usa questo...mi sono accorto di un paio di errori
    Purtroppo bisogna imparare che il computer non sbaglia...fa solo quello che gli dici di fare

    www.netpolaris.it

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.