Advertisement
jsbsan

mmainselect

Feb 14th, 2014
1,130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GAMBAS 0.76 KB | None | 0 0
  1. ' Gambas module file
  2.  
  3. ' Desea calcular una función aleatoria.
  4. ' Repite una función aleatoria mil veces para
  5. ' conocer cuantas veces aparecen los números
  6. ' 1,2,3,4,5 o 6.
  7.  
  8. 'Se declaran publica para que se puedan acceder desde otros modulos/clases
  9. Public valores As New Integer[] 'como es un array siempre se pasa por referencia
  10.  
  11. Public Sub Main()
  12.  
  13.   Dim x As Integer
  14.   Dim w As Integer
  15.   Dim SwitchNumero As Switch
  16.  
  17.   valores.Resize(6) 'creo un array de 6 valores
  18.  
  19.   SwitchNumero = New Switch(valores)
  20.  
  21.   For x = 1 To 100
  22.     w = Int(Rnd(6) + 1)
  23.    
  24.     SwitchNumero.operar(w)
  25.    
  26.   Next
  27.  
  28.   Print "Valores: ", 1, 2, 3, 4, 5, 6
  29.   Print "              ", valores[0], valores[1], valores[2], valores[3], valores[4], valores[5]
  30.  
  31. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement