Jump to content

Combinar letras para formar palabras


verzulsan

Recommended Posts

Posted

Hola

Depende de si estás hablando de combinaciones o permutaciones con o sin repetición. Te pongo el ejemplo más sencillo, permutaciones con repetición, tomando la serie 3x5x3x5x3x5=3375 posibles permutaciones, es como contar normal y corriente solo que el tope no es siempre 10.

Sub PermutacionesRepeticion()
Dim a As Integer, b As Integer, c As Integer, d As Integer, e As Integer, f As Integer
Dim Fila As Long, Palabra As String
Dim Consonante(1 To 3) As String, Vocal(1 To 5) As String
Consonante(1) = "k"
Consonante(2) = "g"
Consonante(3) = "l"
Vocal(1) = "a"
Vocal(2) = "e"
Vocal(3) = "i"
Vocal(4) = "o"
Vocal(5) = "u"

For a = 1 To 3: For b = 1 To 5: For c = 1 To 3: For d = 1 To 5: For e = 1 To 3: For f = 1 To 5
Fila = Fila + 1
Palabra = Consonante(a) & Vocal( & Consonante(c) & Vocal(d) & Consonante(e) & Vocal(f)
Cells(Fila, 1) = Palabra
Next f: Next e: Next d: Next c: Next b: Next a
End Sub[/CODE]

Saludos

Permutaciones con repeticion.xls

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

Privacy Policy