Advertisement
jsbsan

selectcase

Feb 14th, 2014
1,193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GAMBAS 0.62 KB | None | 0 0
  1. ' Desea calcular una función aleatoria.
  2. ' Repite una función aleatoria mil veces para
  3. ' conocer cuantas veces aparecen los números
  4. ' 1,2,3,4,5 o 6.
  5.  
  6. DIM x AS Integer
  7. DIM w AS Integer
  8. DIM a AS Integer
  9. DIM b AS Integer
  10. DIM c AS Integer
  11. DIM d AS Integer
  12. DIM e AS Integer
  13. DIM f AS Integer
  14.  
  15. FOR x = 1 TO 1000
  16.  
  17.   w = Int(Rnd(6) + 1)
  18.  
  19.   SELECT CASE w
  20.     CASE 1
  21.       a = a + 1
  22.     CASE 2
  23.       b = b + 1
  24.     CASE 3
  25.       c = c + 1
  26.     CASE 4
  27.       d = d + 1
  28.     CASE 5
  29.       e = e + 1
  30.     CASE 6
  31.       f = f + 1
  32.     CASE ELSE
  33.       PRINT "¡Esto es imposible!"
  34.   END SELECT
  35.  
  36. NEXT
  37.  
  38. PRINT a, b, c, d, e, f
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement