elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  [Source] Numeros a Letras (De 1 hasta Octillónes Gugol? xS).
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Source] Numeros a Letras (De 1 hasta Octillónes Gugol? xS).  (Leído 3,273 veces)
BlackZeroX
Wiki

Desconectado Desconectado

Mensajes: 3.158


I'Love...!¡.


Ver Perfil WWW
[Source] Numeros a Letras (De 1 hasta Octillónes Gugol? xS).
« en: 23 Octubre 2010, 11:26 am »

.
El siguiente codigo me costo un Ojo de la cara... es para convertir cualquier Numero a Texto Plano. lo hice por Hobby mas que por nesesidad, espero le saquen provecho!¡.

Como maximo mumero que puede leer son es: 999999999999999999999999999999

Novecientos noventa y nueve Octillónes novecientos noventa y nueve Sextillónes novecientos noventa y nueve Quintillónes novecientos noventa y nueve Cuatrillónes novecientos noventa y nueve Trillones novecientos noventa y nueve Billones novecientos noventa y nueve Mil novecientos noventa y nueve Millones novecientos noventa y nueve Mil novecientos noventa y nueve

Billon          10^12       <--( 5 ).
Trillon         10^18       <--( 4 ).
Cuatrillón      10^24       <--( 3 ).
Quintillón      10^30       <--( 2 ).
Sextillón       10^36       <--( 1 ).
Octillón        10^42       <--( 0 ).
<--Obviamente Los siguientes numeros no los tomaremos en cuenta-->
Gúgol           10^100      <--(-1 ).
Googolplex      10^10^Gúgol <--(-2 ).


http://infrangelux.sytes.net/Blog/index.php?option=com_content&view=article&id=8:arrtnum2string&catid=2:catprocmanager&Itemid=8


Código
  1. '
  2. '   /////////////////////////////////////////////////////////////
  3. '   // Autor:   BlackZeroX ( Ortega Avila Miguel Angel )       //
  4. '   //                                                         //
  5. '   // Web:     http://InfrAngeluX.Sytes.Net/                  //
  6. '   //                                                         //
  7. '   //    |-> Pueden Distribuir Este codigo siempre y cuando   //
  8. '   // no se eliminen los creditos originales de este codigo   //
  9. '   // No importando que sea modificado/editado o engrandecido //
  10. '   // o achicado, si es en base a este codigo                 //
  11. '   /////////////////////////////////////////////////////////////
  12.  
  13. Public Function Number2String(ByVal VInNumber As String) As String
  14. '   //  Meximo  --> 999999999999999999999999999999 ' sección Octillón...
  15. '   //  Billon          10^12       <--( 5 ).
  16. '   //  Trillon         10^18       <--( 4 ).
  17. '   //  Cuatrillón      10^24       <--( 3 ).
  18. '   //  Quintillón      10^30       <--( 2 ).
  19. '   //  Sextillón       10^36       <--( 1 ).
  20. '   //  Octillón        10^42       <--( 0 ).
  21. '   //  <--Obviamente Los siguientes numeros no los tomaremos en cuenta-->
  22. '   //  Gúgol           10^100      <--(-1 ).
  23. '   //  Googolplex      10^10^Gúgol <--(-2 ).
  24. Dim Str_Temp                            As String
  25. Dim Byt_Index                           As Byte
  26. Dim Byt_Digito                          As Byte
  27. Dim Byt_Centena                         As Byte
  28. Dim Byt_Decena                          As Byte
  29. Dim Byt_Unidad                          As Byte
  30. Dim Str_Leyenda                         As String
  31. Dim lng_LenStr                          As Long
  32. Const clng_MaxLen = &H1E
  33.  
  34.    lng_LenStr = Len(VInNumber)
  35.    If lng_LenStr > clng_MaxLen Or lng_LenStr = 0 Then Exit Function
  36.    Str_Temp = String$(clng_MaxLen, "0")
  37.    Mid(Str_Temp, clng_MaxLen - lng_LenStr + 1) = Mid$(VInNumber, 1, lng_LenStr)
  38.  
  39.    For Byt_Index = 1 To clng_MaxLen / 3
  40.  
  41.        Byt_Centena = CByte(Mid$(Str_Temp, Byt_Index * 3 - 2, 1))
  42.        Byt_Decena = CByte(Mid$(Str_Temp, Byt_Index * 3 - 1, 1))
  43.        Byt_Unidad = CByte(Mid$(Str_Temp, Byt_Index * 3, 1))
  44.  
  45.        Select Case Byt_Index
  46.            Case 1
  47.                If Byt_Centena + Byt_Decena = 0 And Byt_Unidad = 1 Then
  48.                    Str_Leyenda = "Octillón "
  49.                ElseIf Byt_Centena > 0 Or Byt_Decena > 0 Or Byt_Unidad > 1 Then
  50.                    Str_Leyenda = "Octillónes "
  51.                End If
  52.            Case 2
  53.                If Byt_Centena + Byt_Decena = 0 And Byt_Unidad = 1 Then
  54.                    Str_Leyenda = "Sextillón "
  55.                ElseIf Byt_Centena > 0 Or Byt_Decena > 0 Or Byt_Unidad > 1 Then
  56.                    Str_Leyenda = "Sextillónes "
  57.                End If
  58.            Case 3
  59.                If Byt_Centena + Byt_Decena = 0 And Byt_Unidad = 1 Then
  60.                    Str_Leyenda = "Quintillón "
  61.                ElseIf Byt_Centena > 0 Or Byt_Decena > 0 Or Byt_Unidad > 1 Then
  62.                    Str_Leyenda = "Quintillónes "
  63.                End If
  64.            Case 4
  65.                If Byt_Centena + Byt_Decena = 0 And Byt_Unidad = 1 Then
  66.                    Str_Leyenda = "Cuatrillón "
  67.                ElseIf Byt_Centena > 0 Or Byt_Decena > 0 Or Byt_Unidad > 1 Then
  68.                    Str_Leyenda = "Cuatrillónes "
  69.                End If
  70.            Case 5
  71.                If Byt_Centena + Byt_Decena = 0 And Byt_Unidad = 1 Then
  72.                    Str_Leyenda = "Trillon "
  73.                ElseIf Byt_Centena > 0 Or Byt_Decena > 0 Or Byt_Unidad > 1 Then
  74.                    Str_Leyenda = "Trillones "
  75.                End If
  76.            Case 6
  77.                If Byt_Centena + Byt_Decena = 0 And Byt_Unidad = 1 Then
  78.                    Str_Leyenda = "Billón "
  79.                ElseIf Byt_Centena > 0 Or Byt_Decena > 0 Or Byt_Unidad > 1 Then
  80.                    Str_Leyenda = "Billones "
  81.                End If
  82.            Case 7
  83.                If Byt_Centena + Byt_Decena + Byt_Unidad >= 1 And Val(Mid$(Str_Temp, 21, 3)) = 0 Then
  84.                    Str_Leyenda = "Mil Millones "
  85.                ElseIf Byt_Centena + Byt_Decena + Byt_Unidad >= 1 Then
  86.                    Str_Leyenda = "Mil "
  87.                End If
  88.            Case 8
  89.                If Byt_Centena + Byt_Decena = 0 And Byt_Unidad = 1 Then
  90.                    Str_Leyenda = "Millón "
  91.                ElseIf Byt_Centena > 0 Or Byt_Decena > 0 Or Byt_Unidad > 1 Then
  92.                    Str_Leyenda = "Millones "
  93.                End If
  94.            Case 9
  95.                If Byt_Centena + Byt_Decena + Byt_Unidad >= 1 Then Str_Leyenda = "Mil "
  96.            Case 10
  97.                If Byt_Centena + Byt_Decena + Byt_Unidad >= 1 Then Str_Leyenda = ""
  98.        End Select
  99.        Number2String = Number2String + Centena(Byt_Unidad, Byt_Decena, Byt_Centena) + Decena(Byt_Unidad, Byt_Decena) + Unidad(Byt_Unidad, Byt_Decena) + Str_Leyenda
  100.        Str_Leyenda = ""
  101.    Next
  102.  
  103. End Function
  104.  
  105. Private Function Centena(ByVal Byt_Uni As Byte, ByVal Byt_Decimal As Byte, ByVal Byt_Centena As Byte) As String
  106.    Select Case Byt_Centena
  107.        Case 1: If Byt_Decimal + Byt_Uni = 0 Then Centena = "cien " Else Centena = "ciento "
  108.        Case 2: Centena = "doscientos "
  109.        Case 3: Centena = "trescientos "
  110.        Case 4: Centena = "cuatrocientos "
  111.        Case 5: Centena = "quinientos "
  112.        Case 6: Centena = "seiscientos "
  113.        Case 7: Centena = "setecientos "
  114.        Case 8: Centena = "ochocientos "
  115.        Case 9: Centena = "novecientos "
  116.    End Select
  117. End Function
  118.  
  119. Private Function Decena(ByVal Byt_Uni As Byte, ByVal Byt_Decimal As Byte) As String
  120.    Select Case Byt_Decimal
  121.        Case 1
  122.            Select Case Byt_Uni
  123.                Case 0: Decena = "diez "
  124.                Case 1: Decena = "once "
  125.                Case 2: Decena = "doce "
  126.                Case 3: Decena = "trece "
  127.                Case 4: Decena = "catorce "
  128.                Case 5: Decena = "quince "
  129.                Case 6 To 9: Decena = "dieci "
  130.            End Select
  131.        Case 2
  132.            If Byt_Uni = 0 Then
  133.                Decena = "veinte "
  134.            ElseIf Byt_Uni > 0 Then
  135.                Decena = "veinti "
  136.            End If
  137.        Case 3: Decena = "treinta "
  138.        Case 4: Decena = "cuarenta "
  139.        Case 5: Decena = "cincuenta "
  140.        Case 6: Decena = "sesenta "
  141.        Case 7: Decena = "setenta "
  142.        Case 8: Decena = "ochenta "
  143.        Case 9: Decena = "noventa "
  144.    End Select
  145.    If Byt_Uni > 0 And Byt_Decimal > 2 Then Decena = Decena + "y "
  146. End Function
  147.  
  148. Private Function Unidad(ByVal Byt_Uni As Byte, ByVal Byt_Decimal As Byte) As String
  149.    If Byt_Decimal <> 1 Then
  150.        Select Case Byt_Uni
  151.            Case 1: Unidad = "un "
  152.            Case 2: Unidad = "dos "
  153.            Case 3: Unidad = "tres "
  154.            Case 4: Unidad = "cuatro "
  155.            Case 5: Unidad = "cinco "
  156.        End Select
  157.    End If
  158.    Select Case Byt_Uni
  159.            Case 6: Unidad = "seis "
  160.            Case 7: Unidad = "siete "
  161.            Case 8: Unidad = "ocho "
  162.            Case 9: Unidad = "nueve "
  163.    End Select
  164. End Function
  165.  
  166.  

Dulce Infierno Lunar!¡.


« Última modificación: 23 Octubre 2010, 11:58 am por BlackZeroX▓▓▒▒░░ » En línea

The Dark Shadow is my passion.
79137913


Desconectado Desconectado

Mensajes: 1.169


4 Esquinas


Ver Perfil WWW
Re: [Source] Numeros a Letras (De 1 hasta Octillónes Gugol? xS).
« Respuesta #1 en: 25 Octubre 2010, 14:20 pm »

Hola!!!

Disculpa, debe ser ignorancia mia, pero entre OCTILLONES Y SEXTILLONES...
No van los SEPTILLONES?

Y, usando la escala numérica larga que es la mas usual seria:
novecientos noventa y nueve mil novecientos noventa y nueve cuatrillones novecientos noventa y nueve mil novecientos noventa y nueve trillones novecientos noventa y nueve mil novecientos noventa y nueve billones novecientos noventa y nueve mil novecientos noventa y nueve millones novecientos noventa y nueve mil novecientos noventa y nueve

*Recordemos que para la escala numérica Corta mil millones son un Billón (Creo que estas usando esa, pero parece que se te pasaron los septillones)
*Aca en Arg usamos la Escala numérica Larga, (la de mil millones) tal ves son solo problemas regionales.

Si en algún punto me equivoque espero corrección así puedo aprender Gracias y disculpen mi ignorancia.

GRACIAS POR LEER!!!


« Última modificación: 25 Octubre 2010, 20:17 pm por 79137913 » En línea

"Como no se puede igualar a Dios, ya he decidido que hacer, ¡SUPERARLO!"
"La peor de las ignorancias es no saber corregirlas"

 79137913                          *Shadow Scouts Team*
BlackZeroX
Wiki

Desconectado Desconectado

Mensajes: 3.158


I'Love...!¡.


Ver Perfil WWW
Re: [Source] Numeros a Letras (De 1 hasta Octillónes Gugol? xS).
« Respuesta #2 en: 25 Octubre 2010, 20:28 pm »

.
muchas gracias:

Si se me paso iban los Septillones xP... y todavía pueden ponerse los Nanollones, decallones, etc...

Código:

Mayores que 200

    * Doscientos cincuenta y seis
    * Trescientos
    * Cuatrocientos
    * Cuatrocientos noventa y seis
    * Quinientos
    * Quinientos doce
    * Seiscientos
    * Seiscientos sesenta y seis
    * Setecientos
    * Ochocientos
    * Novecientos
    * Mil
    * Mil veinticuatro
    * Mil setecientos veintinueve
    * Diez mil
    * Cien mil
    * Millón
    * Millardo (mil millones)
    * Billón
    * Trillón
    * Cuatrillón
    * Quintillón
    * Sextillón
    * Septillón
    * Octillón
    * Googol
    * Googolplex


Dulce Infierno Lunar!¡.
En línea

The Dark Shadow is my passion.
ranslsad


Desconectado Desconectado

Mensajes: 492


Dim Ranslsad as String * :P - Que Vicio!


Ver Perfil WWW
Re: [Source] Numeros a Letras (De 1 hasta Octillónes Gugol? xS).
« Respuesta #3 en: 28 Octubre 2010, 18:21 pm »

Dios.. me cantidad de numeros.. y me perdi hace rato jaja
Muy bueno el codigo!

Salu2

Ranslsad
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines