Advertisement
jsbsan

ClaseIntervalo

Oct 30th, 2013
1,529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GAMBAS 0.72 KB | None | 0 0
  1. ' Gambas class file
  2.  
  3. Public Struct dato
  4.     texto As String
  5.     minimo As Integer
  6.     maximo As Integer
  7. End Struct
  8.  
  9. Private listadatos As New Dato[]
  10.  
  11. Public Sub add(tipovaloracion As String, valorminimo As Integer, valormaximo As Integer)
  12.  
  13.   Dim datotemp As New Dato
  14.   datotemp.texto = tipovaloracion
  15.   datotemp.minimo = valorminimo
  16.   datotemp.maximo = valormaximo
  17.  
  18.   listadatos.Add(datotemp)
  19.  
  20. End
  21.  
  22. Public Function responder(numero As Integer) As String
  23.  
  24.   Dim datotmp As Dato
  25.  
  26.   For Each datotmp In listadatos
  27.     If datotmp.minimo <= numero And datotmp.maximo > numero Then Return datotmp.texto
  28.     Next
  29.  
  30.   Return "Error: el valor no se encuentra entre los intervalos reconocidos"
  31.  
  32. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement