SlideShare una empresa de Scribd logo
1 de 34
1.- FACTURA




CODIGO FUENTE
PUBLIC   I AS Integer
PUBLIC   m AS Integer
PUBLIC   R AS Integer
PUBLIC   SUB _new()
END

PUBLIC SUB Form_Open()
TextBox1.SetFocus
GridView1.Columns.Count = 5
GridView1.Rows.Count = 10
GridView1.Columns[0].Width = 50
GridView1.Columns[1].Width = 200
GridView1.Columns[2].Width = 80
GridView1.Columns[3].Width = 80
GridView1.Columns[4].Width = 80
GridView1[0, 0].Text = "NUM"
GridView1[0, 1].Text = "DETALLE"
GridView1[0, 2].Text = "PRECIO U/"
GridView1[0, 3].Text = "CANT"
GridView1[0, 4].Text = "TOTAL"
R=0
I=0
' GridView1[0, 3].Text =
END

PUBLIC SUB TextBox3_KeyPress()
 IF Key.Code = 65293 THEN
 IF TextBox3.Text = "" THEN
 Message("INGRESE UN VALOR")
 TextBox3.SetFocus
ELSE
I=I+1
R=R+1
TextBox1.Text = I
GridView1[r, 0].Text = Val(TextBox8.Text)
GridView1[r, 1].Text = (TextBox1.Text)
GridView1[r, 2].Text = TextBox2.Text
GridView1[r, 3].Text = TextBox3.Text
'precio
TextBox9.Text = Val(TextBox2.Text) * (TextBox3.Text)
GridView1[r, 4].Text = Val(TextBox9.Text)
m = m + Val(TextBox9.Text)
TextBox1.text = ""
TextBox2.text = ""
TextBox3.text = ""
TextBox1.SetFocus
ENDIF
ENDIF
END

PUBLIC SUB Button2_Click()
 TextBox4.Text = m
 TextBox5.Text = (m * 7) / 100
 TextBox6.Text = ((((textBox4.Text) - (TextBox5.text)) * 12) / 100)
 TextBox7.Text = (textBox4.Text) - (TextBox5.Text) + (TextBox6.Text)
END

PUBLIC SUB Button1_Click()
TextBox1.text = ""
TextBox2.text = ""
TextBox3.text = ""
TextBox1.SetFocus
GridView1.Clear
END

PUBLIC SUB TextBox2_KeyPress()
IF Key.Code = 65293 THEN
 IF TextBox2.Text = "" THEN
 Message("INGRESE UN VALOR")
 TextBox2.SetFocus
 ELSE
   TextBox3.SetFocus
 ENDIF
 ENDIF
END

PUBLIC SUB TextBox1_KeyPress()
IF Key.Code = 65293 THEN
 IF TextBox2.Text = "" THEN
 Message("INGRESE UN VALOR")
 TextBox2.SetFocus
 ELSE
   TextBox3.SetFocus
 ENDIF
 ENDIF
END
2.- CALCULADORA




' Gambas class file
PUBLIC BAN AS Integer
PUBLIC OP1 AS Float
PUBLIC OP2 AS Float

PUBLIC SUB Button1_Click()
TextBox1.Text = TextBox1.Text & "1"
END

PUBLIC SUB Button2_Click(
TextBox1.Text = TextBox1.Text & "2"
END

PUBLIC SUB Button3_Click()
 TextBox1.Text = TextBox1.Text & "3"
END

PUBLIC SUB Button6_Click()
 TextBox1.Text = TextBox1.Text & "4"
END
PUBLIC SUB Button7_Click()
 TextBox1.Text = TextBox1.Text & "5"
END

PUBLIC SUB Button8_Click()
 TextBox1.Text = TextBox1.Text & "6"
END

PUBLIC SUB Button11_Click()
 TextBox1.Text = TextBox1.Text & "7"
END

PUBLIC SUB Button9_Click()
 TextBox1.Text = TextBox1.Text & "8"
END

PUBLIC SUB Button10_Click()
 TextBox1.Text = TextBox1.Text & "9"

END

PUBLIC SUB Button4_Click()
 TextBox1.Text = TextBox1.Text & "0"
END

PUBLIC SUB Button5_Click()
 TextBox1.Text = TextBox1.Text & "00"
END

PUBLIC SUB Button18_Click()
FMain.CLOSE
END

PUBLIC SUB Button17_Click()
 TextBox1.Text = TextBox1.Text & "."
END

PUBLIC SUB Button16_Click()
BAN = 1
IF TextBox1.Text <> 0 THEN
OP1 = TextBox1.Text
ELSE
OP1 = 0
ENDIF
TextBox1.Clear
END

PUBLIC SUB Button19_Click()
 TextBox1.Text = ""
END

PUBLIC SUB Button15_Click()
 BAN = 2
IF TextBox1.Text <> 0 THEN
OP1 = TextBox1.Text
ELSE
OP1 = 0
ENDIF
TextBox1.Clear
END

PUBLIC SUB Button13_Click()
 BAN = 3
IF TextBox1.Text <> 0 THEN
OP1 = TextBox1.Text
ELSE
OP1 = 0
ENDIF
TextBox1.Clear
END

PUBLIC SUB Button12_Click()
 BAN = 4
IF TextBox1.Text <> 0 THEN
OP1 = TextBox1.Text
ELSE
OP1 = 0
ENDIF
TextBox1.Clear
END

PUBLIC SUB Button14_Click()
 IF TextBox1.Text <> 0 THEN
OP2 = TextBox1.Text
ELSE
OP2 = 0
ENDIF
TextBox1.Text = OPERACION(OP1, OP2, BAN)
END

PUBLIC FUNCTION OPERACION(V1 AS Float, V2 AS Float, OPER AS Float) AS Float
 DIM RE AS Float
 DIM X, Y, Z, X1, Y1, Z1, X2, Y2, Z2 AS Integer
  DIM valor, i AS Integer
  DIM cadena, cadena2 AS String
 DIM XX, MEA AS String
 SELECT CASE OPER
    CASE 1
    RE = V1 + V2
   Z2 = 1
    CASE 2
    RE = V1 - V2
   Z2 = 1
    CASE 3
    RE = V1 * V2
   Z2 = 1
    CASE 4
    RE = V1 / V2
    Z2 = 1
    CASE 5
    RE = (V1 * V2) / 100
   Z2 = 1
    CASE 6
    RE = V1 ^ V2
    Z2 = 1
   CASE 7
    RE = V1 ^ 2
    Z2 = 1
   CASE 8
   RE = V1 ^ 3
   Z2 = 1
   CASE 9
   RE = 1 / V1
   Z2 = 1
  END SELECT
IF Z2 = 1
 RETURN RE
ELSE
 RETURN Y1
ENDIF
END
PUBLIC SUB Button20_Click()
BAN = 5
IF TextBox1.Text <> 0 THEN
OP1 = TextBox1.Text
ELSE
OP1 = 0
ENDIF
TextBox1.Clear
END

PUBLIC SUB Button21_Click()
BAN = 6
IF TextBox1.Text <> 0 THEN
OP1 = TextBox1.Text
ELSE
OP1 = 0
ENDIF
TextBox1.Clear
END

PUBLIC SUB Button22_Click()

 BAN = 7
IF TextBox1.Text <> 0 THEN
OP1 = TextBox1.Text
ELSE
OP1 = 0
ENDIF
TextBox1.Text = OP1
END

PUBLIC SUB Button23_Click()
DIM valor, x1, x2, i AS Integer
DIM cadena, cadena2 AS String
 valor = TextBox1.Text
 WHILE valor > 0
   x1 = valor MOD 2
   x2 = Int(valor / 2)
   cadena = cadena & Str(x1)
   valor = x2
 WEND
 FOR i = Len(cadena) TO 1 STEP -1
   cadena2 = cadena2 & (Mid(cadena, i, 1))
  NEXT
 TextBox1.Text = cadena2
END

PUBLIC SUB Button25_Click()
'Calculo a octal de un número decimal
DIM valor, x1, x2, i AS Integer
DIM cadena, cadena2 AS String
 valor = TextBox1.Text
 WHILE valor > 0
    x1 = valor MOD 16
    x2 = Int(valor / 16)
    IF x1 = 10 THEN
    cadena = cadena & "A"
    ELSE
    IF x1 = 11 THEN
    cadena = cadena & "B"
    ELSE
    IF x1 = 12 THEN
    cadena = cadena & "C"
    ELSE
    IF x1 = 13 THEN
    cadena = cadena & "D"
    ELSE
    IF x1 = 14 THEN
    cadena = cadena & "E"
    ELSE
    IF x1 = 15 THEN
    cadena = cadena & "F"
    ELSE
    cadena = cadena & Str(x1)
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    valor = x2
 WEND
 FOR i = Len(cadena) TO 1 STEP -1
    cadena2 = cadena2 & (Mid(cadena, i, 1))
  NEXT
 TextBox1.Text = cadena2
END

PUBLIC SUB Button24_Click()
'Calculo a octal de un número decimal
DIM valor, x1, x2, i AS Integer
DIM cadena, cadena2 AS String
 valor = TextBox1.Text
  WHILE valor > 0
   x1 = valor MOD 8
   x2 = Int(valor / 8)
   cadena = cadena & Str(x1)
   valor = x2
 WEND
 FOR i = Len(cadena) TO 1 STEP -1
   cadena2 = cadena2 & (Mid(cadena, i, 1))
  NEXT
 TextBox1.Text = cadena2
END

PUBLIC SUB Button29_Click()
TextBox1.Text = TextBox1.Text ^ 3
END

PUBLIC SUB Button27_Click()
TextBox1.Text = 1 / TextBox1.Text
END

PUBLIC SUB Button26_Click()
' DIM N AS Float
IF TextBox1.Text = "" THEN
Message("INGRESE DATO")
' ELSE
' IF RadioButton1.Value = TRUE THEN
' N = Str(Sin(Val(TextBox1.Text)))
' TextBox1.Text = N
' RadioButton2.Value = FALSE
ELSE
' IF RadioButton2.Value = TRUE THEN
TextBox1.Text = Sin(Pi * (Val(TextBox1.Text)) / 180)
' ENDIF
' ENDIF
ENDIF
END

PUBLIC SUB Button31_Click()
' DIM N AS Float
' N = Cos(TextBox1.Text)
' TextBox1.Text = N
IF TextBox1.Text = "" THEN
Message("INGRESE DATO")
ELSE
TextBox1.Text = Cos(Pi * (Val(TextBox1.Text)) / 180)
ENDIF
END

PUBLIC SUB Button30_Click()
 IF TextBox1.Text = "" THEN
Message("INGRESE DATO")
ELSE
TextBox1.Text = Tan(Pi * (Val(TextBox1.Text)) / 180)
ENDIF
END

PUBLIC SUB Button28_Click()
 DIM FAC, N AS Float
 N = TextBox1.Text
 FAC = 1
 WHILE (N <> 0)
 FAC = FAC * N
 N=N-1
 TextBox1.Text = FAC
 WEND
END
3.- PORCENTAJE DE
                       UN PRODUCTO




PUBLIC SUB Main()
DIM A AS Integer
DIM B AS Integer
DIM C AS Integer
DIM T AS Integer
DIM PM AS Float
DIM PC AS Float
DIM PO AS Float
A = 300
B = 400
C = 800
T=A+B+C
PM = (300 * 100) / T
PC = (400 * 100) / T
PO = (800 * 100) / T
PRINT "EL TOTAL ES...."
PRINT T
PRINT "EL PORCENTAJE DE MAIZ ES...."
PRINT PM & "%"
PRINT "EL PORCENTAJE DE CAFE ES...."
PRINT PC & "%"
PRINT "EL PORCENTAJE DE CACAO ES...."
PRINT PO & "%"
END




            4.- REALIZAR UN
                              CÍRCULO




PUBLIC r AS Integer
PUBLIC pox AS Integer
PUBLIC poy AS Integer
PUBLIC SUB _new()
END

PUBLIC SUB Form_Open()
r = 30
END

PUBLIC SUB Button1_Click()
 area1.Clear
 pox = area1.Height / 2
 poy = area1.Width / 2
 Draw.Begin(area1)
 Draw.FillColor = Color.RGB(200, 190, 50)
 Draw.FillStyle = Fill.BackDiagonal
 Draw.FillStyle = Fill.Dense37
 Draw.Circle(pox, poy, r)
 r = r + 10
Draw.End
END

PUBLIC SUB Button3_Click()
 ME.Close
END

PUBLIC SUB Button2_Click()
area1.Clear
 pox = area1.Height / 2
 poy = area1.Width / 2
 Draw.Begin(area1)
 Draw.FillColor = Color.RGB(200, 190, 50)
 Draw.FillStyle = Fill.Vertical
 Draw.FillStyle = Fill.Cross
 Draw.Circle(pox, poy, r)
 r = r - 10
Draw.End
END

PUBLIC SUB Button4_Click()
 DIM n1, n2, n3 AS Integer
RANDOMIZE
 n1 = Int(Rnd() * 1000)
' TextBox1.Text = n1
  area1.Clear
 pox = area1.Height / 2
 poy = area1.Width / 2
Draw.Begin(area1)
 Draw.FillColor = Color.RGB(200, 190, 50)
 Draw.FillStyle = Fill.CrossDiagonal
 Draw.FillStyle = Fill.Cross
 Draw.Circle(pox, poy, n1)
 Draw.Ellipse(pox, poy, n1, n1)
 r = r - 10
 n2 = Int(Rnd() * 10)
 Draw.Ellipse(pox, poy, n2, n2)
 Draw.Line(pox, poy, n2, n2)
 Draw.Rect(pox, poy, n2)
 n3 = Int(Rnd() * 10)
END




         5.- PROTECTOR DE
                          PANTALLA
' Gambas class file
PUBLIC SUB Form_Open()
Timer1.Enabled = TRUE
Timer2.Enabled = TRUE
Timer3.Enabled = TRUE
Timer4.Enabled = TRUE
Timer5.Enabled = TRUE
END

PUBLIC SUB Timer1_Timer()
DIM c1, c2, c, posy, posx AS Integer
C1 = Int(Rnd() * 700)
C2 = Int(Rnd() * 700)
C = Int(Rnd() * 20)
posy = Area1.Height / 2
posx = Area1.Width / 2
 Draw.Begin(area1)
 Draw.FillColor = Color.RGB((160 + c1), (2 + c2), (c1 + C2))
' coge los colores que se designen
  Draw.FillStyle = Fill.Solid
  Draw.Circle(posy, C2, C)
  Draw.End
END

PUBLIC SUB Button1_Click()
ME.Close
END
PUBLIC SUB Timer2_Timer()
 DIM c1, c2, c AS Integer
C1 = Int(Rnd() * 1000)
C2 = Int(Rnd() * 1000)
C = Int(Rnd() * 400)
' posy = Area1.Height / 2
' posx = Area1.Width / 2
 Draw.Begin(area1)
 Draw.FillColor = Color.RGB((160 + c1), (2 + c2), (c1 + C2))
' coge los colores que se designen
  Draw.FillStyle = Fill.Diagonal
  Draw.Ellipse(C1, C2, C, c)
  Draw.End
END

PUBLIC SUB Timer3_Timer()
  DIM c1, c2, c AS Integer
C1 = Int(Rnd() * 600)
C2 = Int(Rnd() * 600)
C = Int(Rnd() * 40)
' posy = Area1.Height / 2
' posx = Area1.Width / 2
 Draw.Begin(area1)
 Draw.FillColor = Color.RGB((300 + c1), (7 + c2), (c1 + C2))
' coge los colores que se designen
  Draw.FillStyle = Fill.Dense94
  Draw.Line(C1, C2, C, c)
  Draw.End
END

PUBLIC SUB Timer4_Timer()
  DIM c1, c2, c, r AS Integer
C1 = Int(Rnd() * 600)
C2 = Int(Rnd() * 600)
C = Int(Rnd() * 40)
' posy = Area1.Height / 2
' posx = Area1.Width / 2
 Draw.Begin(area1)
 Draw.FillColor = Color.RGB((200 + c1), (5 + c2), (c1 + C2))
' coge los colores que se designen
  Draw.FillStyle = Fill.Dense94
  Draw.Rect(C1, C2, c, c)
  Draw.End
END

PUBLIC SUB Timer5_Timer()
   DIM c1, c2, c, r AS Integer
  IF Timer5.Delay > 10 THEN
Area1.Clear
TextBox2.Text = ""
TextBox2.Text = Timer
ELSE
C1 = Int(Rnd() * 600)
C2 = Int(Rnd() * 600)
C = Int(Rnd() * 40)
' posy = Area1.Height / 2
' posx = Area1.Width / 2
 Draw.Begin(area1)
 Draw.FillColor = Color.RGB((200 + c1), (5 + c2), (c1 + C2))
' coge los colores que se designen
  Draw.FillStyle = Fill.Dense94
  'Draw.Polygon(C1, C2)
  Draw.End
  TextBox2.Text = Timer
ENDIF
END




          6.- RELOJ DIGITAL
PUBLIC SUB Form_Open()
timer1.Enabled = TRUE
END

PUBLIC SUB Timer1_Timer()
timer1.Delay = 1000
TextLabel1.Text = Time(Hour(Now), Minute(Now), Second(Now))
END

PUBLIC SUB Button1_Click()
Message.Info("Es facil programar en Gambas")
ME.CLOSE
END

PUBLIC SUB Button2_Click()
 Message.Delete("Ejemplo de Reloj Digital ")
END

PUBLIC SUB Form_Activate()
 TextBox1.text = TextLabel1.Text = Time(Hour(Now))
END
7.- VERIFICADOR DE #
                              DE CEDULA




PUBLIC SUB Main()
DIM NUM_CED, NOMBRE AS String
DIM A, B, C, D, E, F, G, H, I, J, K, L AS Integer
PRINT "INGRESE SU NOMBRE"
INPUT NOMBRE
PRINT "INGRESE NUMERO DE CEDULA"
INPUT NUM_CED
FOR A = 1 TO 9 STEP 1
B = Str(Mid(NUM_CED, A, 1))
C = A MOD 2
IF C = 0 THEN
H=H+B
ELSE
G=B*2
IF G > 9 THEN
C = G MOD 10
D = Int(G / 10)
E=C+D
ELSE
E=G
ENDIF
 F=F+E
 ENDIF
NEXT
 I=F+H
 J = I MOD 10
 K = 10 - J
 L = Mid(NUM_CED, 1, 9)
 PRINT "EL NUMERO DE SU CEDULA ES...." & Str(L) & "-" & Str(K)
END




      8.- UTILIZACION DE
                          FUNCIONES
' Gambas module file
PRIVATE heroe AS superheroe
PRIVATE heroe1 AS superheroe
PRIVATE heroe2 AS superheroe
'atributos
PUBLIC SUB Main()
' DIM heroe AS superheroe
' DIM heroe1 AS superheroe
heroe = NEW superheroe
heroe1 = NEW superheroe
heroe2 = NEW superheroe

heroe.nombre = "AQUILES MEJIA"
heroe.actor = "DRAGON BALL Z "
heroe.habilidad = "JENQUI DAMA "
heroe.imprime()

heroe1.nombre = "EDUARDO MEJIA "
heroe1.actor = "SUPERMAN "
heroe1.habilidad = "BOLAR POR LOS AIRES"
heroe1.imprime()
WITH heroe2
.nombre = "Zorro"
.actor = "Antonio Bandera"
.habilidad = "Peliar Con La Espada"
.imprime()
END WITH
END




PUBLIC nombre AS String
PUBLIC actor AS String
PUBLIC habilidad AS String

PUBLIC FUNCTION imprime()
'PRINT "Hola mi nombre es: " & Str(nombre) & " Mi personaje favorito es: " & Str(actor) & " Y su habilidad
es: " & Str(habilidad)
PRINT "Hola mi nombre es: " & nombre & " Mi personaje favorito es: " & actor & " Y su habilidad es: " &
habilidad
END
9.- CONVERTIDOR DE
    NUMEROS A LETRAS




' Gambas class file
PUBLIC FUNCTION EnLetras(numero AS String) AS String
   DIM b, paso AS Integer
   DIM expresion, entero, deci, flag AS String
   flag = "N"
   FOR paso = 1 TO Len(numero)
      IF Mid(numero, paso, 1) = "." THEN
         flag = "S"
      ELSE
         IF flag = "N" THEN
            entero = entero & Mid(numero, paso, 1) 'Extae la parte entera del numero
         ELSE
            deci = deci & Mid(numero, paso, 1) 'Extrae la parte decimal del numero
         END IF
      END IF
   NEXT
' paso
IF Len(deci) = 1 THEN
     deci = deci & "0"
  END IF
  flag = "N"
  IF Val(numero) >= -999999999 AND Val(numero) <= 999999999 THEN 'si el numero esta dentro de 0 a
999.999.999

    FOR paso = Len(entero) TO 1 STEP -1
      b = Len(entero) - (paso - 1)
      SELECT CASE paso
      CASE 3, 6, 9
        SELECT CASE Mid(entero, b, 1)
           CASE "1"
             IF Mid(entero, b + 1, 1) = "0" AND Mid(entero, b + 2, 1) = "0" THEN
                expresion = expresion & "Cien "
             ELSE
                expresion = expresion & "Ciento "
             END IF
           CASE "2"
             expresion = expresion & "Doscientos "
           CASE "3"
             expresion = expresion & "Trescientos "
           CASE "4"
             expresion = expresion & "Cuatrocientos "
           CASE "5"
             expresion = expresion & "Quinientos "
           CASE "6"
             expresion = expresion & "Seiscientos "
           CASE "7"
             expresion = expresion & "Setecientos "
           CASE "8"
             expresion = expresion & "Ochocientos "
           CASE "9"
             expresion = expresion & "Novecientos "
        END SELECT
      CASE 2, 5, 8
        SELECT CASE Mid(entero, b, 1)
           CASE "1"
             IF Mid(entero, b + 1, 1) = "0" THEN
                flag = "S"
                expresion = expresion & "Diez "
             END IF
             IF Mid(entero, b + 1, 1) = "1" THEN
                flag = "S"
expresion = expresion & "Once "
  END IF
  IF Mid(entero, b + 1, 1) = "2" THEN
     flag = "S"
     expresion = expresion & "Doce "
  END IF
  IF Mid(entero, b + 1, 1) = "3" THEN
     flag = "S"
     expresion = expresion & "Trece "
  END IF
  IF Mid(entero, b + 1, 1) = "4" THEN
     flag = "S"
     expresion = expresion & "Catorce "
  END IF
  IF Mid(entero, b + 1, 1) = "5" THEN
     flag = "S"
     expresion = expresion & "Quince "
  END IF
  IF Mid(entero, b + 1, 1) > "5" THEN
     flag = "N"
     expresion = expresion & "Dieci"
  END IF

CASE "2"
  IF Mid(entero, b + 1, 1) = "0" THEN
     expresion = expresion & "Veinte "
     flag = "S"
  ELSE
     expresion = expresion & "Veinti"
     flag = "N"
  END IF

CASE "3"
  IF Mid(entero, b + 1, 1) = "0" THEN
     expresion = expresion & "Treinta "
     flag = "S"
  ELSE
     expresion = expresion & "Treinta y "
     flag = "N"
  END IF

CASE "4"
  IF Mid(entero, b + 1, 1) = "0" THEN
     expresion = expresion & "Cuarenta "
flag = "S"
  ELSE
    expresion = expresion & "Cuarenta y "
    flag = "N"
  END IF

CASE "5"
  IF Mid(entero, b + 1, 1) = "0" THEN
     expresion = expresion & "Cincuenta "
     flag = "S"
  ELSE
     expresion = expresion & "Cincuenta y "
     flag = "N"
  END IF

CASE "6"
  IF Mid(entero, b + 1, 1) = "0" THEN
     expresion = expresion & "Sesenta "
     flag = "S"
  ELSE
     expresion = expresion & "Sesenta y "
     flag = "N"
  END IF

CASE "7"
  IF Mid(entero, b + 1, 1) = "0" THEN
     expresion = expresion & "Setenta "
     flag = "S"
  ELSE
     expresion = expresion & "Setenta y "
     flag = "N"
  END IF

CASE "8"
  IF Mid(entero, b + 1, 1) = "0" THEN
     expresion = expresion & "Ochenta "
     flag = "S"
  ELSE
     expresion = expresion & "Ochenta y "
     flag = "N"
  END IF

CASE "9"
  IF Mid(entero, b + 1, 1) = "0" THEN
expresion = expresion & "Noventa "
        flag = "S"
     ELSE
        expresion = expresion & "Noventa y "
        flag = "N"
     END IF
  END SELECT

CASE 1, 4, 7
  SELECT CASE Mid(entero, b, 1)
    CASE "1"
      IF flag = "N" THEN
         IF paso = 1 THEN
            expresion = expresion & "Uno "
         ELSE
            expresion = expresion & "Un "
         END IF
      END IF
    CASE "2"
      IF flag = "N" THEN
         expresion = expresion & "Dos "
      END IF
    CASE "3"
      IF flag = "N" THEN
         expresion = expresion & "Tres "
      END IF
    CASE "4"
      IF flag = "N" THEN
         expresion = expresion & "Cuatro "
      END IF
    CASE "5"
      IF flag = "N" THEN
         expresion = expresion & "Cinco "

      END IF
    CASE "6"
      IF flag = "N" THEN
         expresion = expresion & "Seis "
      END IF
    CASE "7"
      IF flag = "N" THEN
         expresion = expresion & "Siete "
      END IF
    CASE "8"
IF flag = "N" THEN
                   expresion = expresion & "Ocho "
                END IF
              CASE "9"
                IF flag = "N" THEN
                   expresion = expresion & "Nueve "
                END IF
           END SELECT
        END SELECT
        IF paso = 4 THEN
           IF Mid(entero, 6, 1) <> "0" OR Mid(entero, 5, 1) <> "0" OR Mid(entero, 4, 1) <> "0" OR (Mid(entero,
6, 1) = "0" AND Mid(entero, 5, 1) = "0" AND Mid(entero, 4, 1) = "0" AND Len(entero) <= 6) THEN
              expresion = expresion & "mil "
           END IF
        END IF
        IF paso = 7 THEN
           IF Len(entero) = 7 AND Mid(entero, 1, 1) = "1" THEN
              expresion = expresion & "Millón "
           ELSE
              expresion = expresion & "Millones "
           END IF
        END IF
     NEXT
'     paso

    IF deci <> "" THEN
       IF Mid(entero, 1, 1) = "-" THEN 'si el numero es negativo
          expresion = "menos " & expresion & "con " & deci & "/100"
       ELSE
          expresion = expresion & "con " & deci & "/100"
       END IF
    ELSE
       IF Mid(entero, 1, 1) = "-" THEN 'si el numero es negativo
          expresion = "menos " & expresion
       ELSE
          expresion = expresion
       END IF
    END IF
  ELSE 'si el numero a convertir esta fuera del rango superior e inferior
    expresion = ""
  END IF
  TextBox2.Text = expresion
END FUNCTION
PUBLIC SUB Button1_Click()
ME.Close
END

PUBLIC SUB TextBox1_KeyPress()
IF Key.Code = 65293 THEN
  EnLetras(TextBox1.Text)
ENDIF
END




     10.- ENCONTRAR EL
              MAYOR, MENOR,
        INTERMEDIO DE UN
                                 NÚMERO
' Gambas module file
'entre tres numeros distintos mayor medio menor igual
PUBLIC SUB Main()
DIM a, b, c AS Integer
a = 15
b = 100
c = 22
IF a > b AND a > c THEN
PRINT "El mayor es...:" & Str(a)
  IF b > c THEN
  PRINT "El intermedio es...:" & Str(b)
  PRINT "El menor es...:" & Str(c)
  ELSE
  PRINT "El intermedio es...:" & Str(c)
  PRINT "El menor es...:" & Str(b)
  ENDIF
ELSE
   IF b > c THEN
    PRINT "El mayor es...:" & Str(b)
    IF a > c THEN
    PRINT "El intermedio es...:" & Str(a)
    PRINT "El menor es...:" & Str(c)
  ELSE
PRINT "El intermedio es...:" & Str(c)
PRINT "El menor es...:" & Str(a)
ENDIF
ELSE
PRINT "El mayor es...:" & Str(c)
IF a > b THEN
PRINT "El intermedio es...:" & Str(a)
PRINT "El menor es...:" & Str(b)
ELSE
PRINT "El intermedio es...:" & Str(b)
PRINT "El menor es...:" & Str(a)
ENDIF
ENDIF
ENDIF
END




          11.- CRONOMETRO
Gambas class file
PUBLIC SUB Timer1_Timer()
  SEG.Text = Val(SEG.Text) + 1
  IF SEG.Text = 60 THEN
  MIN.Text = Val(MIN.Text) + 1
  SEG.Text = 0
  ENDIF
  IF MIN.Text = 60 THEN
  HOR.Text = Val(HOR.Text) + 1
  MIN.Text = 0
  ENDIF
 IF HOR.Text = 24 THEN
   HOR.Text = 0
   ENDIF
 END
PUBLIC SUB Button1_Click()
IF Button1.Text = "INICIAR" THEN
  Timer1.Enabled = TRUE
  Button1.Caption = "PARAR"
ELSE
IF Button1.Text = "PARAR" THEN
Timer1.Enabled = FALSE
Button1.Caption = "INICIAR"
ENDIF
ENDIF
END
PUBLIC SUB Button2_Click()
 Me.close
END

Más contenido relacionado

La actualidad más candente

Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subirguest9da3a3
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subirguest9da3a3
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subirguest9da3a3
 
Proyecto 2er Parcial
Proyecto 2er ParcialProyecto 2er Parcial
Proyecto 2er ParcialYuliana9_7
 
Burger doll order form
Burger doll order formBurger doll order form
Burger doll order formKhairi Aiman
 
Codigo Fuente De Ejercicios De Gambas
Codigo Fuente De Ejercicios De GambasCodigo Fuente De Ejercicios De Gambas
Codigo Fuente De Ejercicios De Gambasmikyken
 
The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88Mahmoud Samir Fayed
 
PyTrening 2.0 # 15 Okienka GUI
PyTrening 2.0 # 15 Okienka GUIPyTrening 2.0 # 15 Okienka GUI
PyTrening 2.0 # 15 Okienka GUIMoniaJ
 

La actualidad más candente (13)

Gambas
Gambas Gambas
Gambas
 
Proyecto Blob
Proyecto BlobProyecto Blob
Proyecto Blob
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Yolygambas
YolygambasYolygambas
Yolygambas
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Proyecto 2er Parcial
Proyecto 2er ParcialProyecto 2er Parcial
Proyecto 2er Parcial
 
Burger doll order form
Burger doll order formBurger doll order form
Burger doll order form
 
Codigo Fuente De Ejercicios De Gambas
Codigo Fuente De Ejercicios De GambasCodigo Fuente De Ejercicios De Gambas
Codigo Fuente De Ejercicios De Gambas
 
The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184
 
Area de un triangulo
Area de un trianguloArea de un triangulo
Area de un triangulo
 
The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88
 
PyTrening 2.0 # 15 Okienka GUI
PyTrening 2.0 # 15 Okienka GUIPyTrening 2.0 # 15 Okienka GUI
PyTrening 2.0 # 15 Okienka GUI
 

Destacado

Firma Digital
Firma DigitalFirma Digital
Firma Digitaleduann
 
Resumen del audio
Resumen del audioResumen del audio
Resumen del audioeduann
 
El Sistema Binario Eduann
El Sistema Binario EduannEl Sistema Binario Eduann
El Sistema Binario Eduanneduann
 
Ejemplo En Gambas
Ejemplo En GambasEjemplo En Gambas
Ejemplo En Gambaseduann
 
Diferecia Entre Hub Y Switch Listo
Diferecia Entre Hub Y Switch ListoDiferecia Entre Hub Y Switch Listo
Diferecia Entre Hub Y Switch Listoeduann
 
Conociendo el hardware
Conociendo el hardwareConociendo el hardware
Conociendo el hardwareyelitzaoviedo
 
Qué Son Las Ti Cs
Qué Son Las Ti CsQué Son Las Ti Cs
Qué Son Las Ti Cseduann
 
Historia De Linux
Historia De LinuxHistoria De Linux
Historia De Linuxeduann
 

Destacado (8)

Firma Digital
Firma DigitalFirma Digital
Firma Digital
 
Resumen del audio
Resumen del audioResumen del audio
Resumen del audio
 
El Sistema Binario Eduann
El Sistema Binario EduannEl Sistema Binario Eduann
El Sistema Binario Eduann
 
Ejemplo En Gambas
Ejemplo En GambasEjemplo En Gambas
Ejemplo En Gambas
 
Diferecia Entre Hub Y Switch Listo
Diferecia Entre Hub Y Switch ListoDiferecia Entre Hub Y Switch Listo
Diferecia Entre Hub Y Switch Listo
 
Conociendo el hardware
Conociendo el hardwareConociendo el hardware
Conociendo el hardware
 
Qué Son Las Ti Cs
Qué Son Las Ti CsQué Son Las Ti Cs
Qué Son Las Ti Cs
 
Historia De Linux
Historia De LinuxHistoria De Linux
Historia De Linux
 

Similar a ejemplos gambas

Similar a ejemplos gambas (20)

Calculadora
CalculadoraCalculadora
Calculadora
 
Ejercicios
EjerciciosEjercicios
Ejercicios
 
Ejercicios
EjerciciosEjercicios
Ejercicios
 
Ejerciciosdeprogramacion
EjerciciosdeprogramacionEjerciciosdeprogramacion
Ejerciciosdeprogramacion
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Yolygambas
YolygambasYolygambas
Yolygambas
 
Yolygambas
YolygambasYolygambas
Yolygambas
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
Yuliana
YulianaYuliana
Yuliana
 
Codigo Fuente De Ejercicios De Gambas
Codigo Fuente De Ejercicios De GambasCodigo Fuente De Ejercicios De Gambas
Codigo Fuente De Ejercicios De Gambas
 
Visual Basic
Visual BasicVisual Basic
Visual Basic
 
Vb file
Vb fileVb file
Vb file
 
Reservasi hotel
Reservasi hotelReservasi hotel
Reservasi hotel
 
Updated Visual Basic 6 for beginners.pptx
Updated Visual Basic 6 for beginners.pptxUpdated Visual Basic 6 for beginners.pptx
Updated Visual Basic 6 for beginners.pptx
 
Xi CBSE Computer Science lab programs
Xi CBSE Computer Science lab programsXi CBSE Computer Science lab programs
Xi CBSE Computer Science lab programs
 
Visual Basic(Vb) practical
Visual Basic(Vb) practicalVisual Basic(Vb) practical
Visual Basic(Vb) practical
 
Juego
JuegoJuego
Juego
 
Manual de sistemas
Manual de sistemasManual de sistemas
Manual de sistemas
 
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersAnswers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
 

Más de eduann

Impresoras M T I
Impresoras M T IImpresoras M T I
Impresoras M T Ieduann
 
Complement Os
Complement OsComplement Os
Complement Oseduann
 
Aritmetica De Binario Ss
Aritmetica De Binario SsAritmetica De Binario Ss
Aritmetica De Binario Sseduann
 
Organizac[1]..
Organizac[1]..Organizac[1]..
Organizac[1]..eduann
 
Organizac[1]..
Organizac[1]..Organizac[1]..
Organizac[1]..eduann
 
Sistemas De Numeracion Eduann
Sistemas De Numeracion EduannSistemas De Numeracion Eduann
Sistemas De Numeracion Eduanneduann
 

Más de eduann (6)

Impresoras M T I
Impresoras M T IImpresoras M T I
Impresoras M T I
 
Complement Os
Complement OsComplement Os
Complement Os
 
Aritmetica De Binario Ss
Aritmetica De Binario SsAritmetica De Binario Ss
Aritmetica De Binario Ss
 
Organizac[1]..
Organizac[1]..Organizac[1]..
Organizac[1]..
 
Organizac[1]..
Organizac[1]..Organizac[1]..
Organizac[1]..
 
Sistemas De Numeracion Eduann
Sistemas De Numeracion EduannSistemas De Numeracion Eduann
Sistemas De Numeracion Eduann
 

Último

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxdhanalakshmis0310
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 

Último (20)

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 

ejemplos gambas

  • 1.
  • 2. 1.- FACTURA CODIGO FUENTE PUBLIC I AS Integer PUBLIC m AS Integer PUBLIC R AS Integer PUBLIC SUB _new() END PUBLIC SUB Form_Open() TextBox1.SetFocus GridView1.Columns.Count = 5 GridView1.Rows.Count = 10 GridView1.Columns[0].Width = 50 GridView1.Columns[1].Width = 200 GridView1.Columns[2].Width = 80 GridView1.Columns[3].Width = 80 GridView1.Columns[4].Width = 80 GridView1[0, 0].Text = "NUM" GridView1[0, 1].Text = "DETALLE" GridView1[0, 2].Text = "PRECIO U/" GridView1[0, 3].Text = "CANT"
  • 3. GridView1[0, 4].Text = "TOTAL" R=0 I=0 ' GridView1[0, 3].Text = END PUBLIC SUB TextBox3_KeyPress() IF Key.Code = 65293 THEN IF TextBox3.Text = "" THEN Message("INGRESE UN VALOR") TextBox3.SetFocus ELSE I=I+1 R=R+1 TextBox1.Text = I GridView1[r, 0].Text = Val(TextBox8.Text) GridView1[r, 1].Text = (TextBox1.Text) GridView1[r, 2].Text = TextBox2.Text GridView1[r, 3].Text = TextBox3.Text 'precio TextBox9.Text = Val(TextBox2.Text) * (TextBox3.Text) GridView1[r, 4].Text = Val(TextBox9.Text) m = m + Val(TextBox9.Text) TextBox1.text = "" TextBox2.text = "" TextBox3.text = "" TextBox1.SetFocus ENDIF ENDIF END PUBLIC SUB Button2_Click() TextBox4.Text = m TextBox5.Text = (m * 7) / 100 TextBox6.Text = ((((textBox4.Text) - (TextBox5.text)) * 12) / 100) TextBox7.Text = (textBox4.Text) - (TextBox5.Text) + (TextBox6.Text) END PUBLIC SUB Button1_Click() TextBox1.text = "" TextBox2.text = "" TextBox3.text = "" TextBox1.SetFocus GridView1.Clear
  • 4. END PUBLIC SUB TextBox2_KeyPress() IF Key.Code = 65293 THEN IF TextBox2.Text = "" THEN Message("INGRESE UN VALOR") TextBox2.SetFocus ELSE TextBox3.SetFocus ENDIF ENDIF END PUBLIC SUB TextBox1_KeyPress() IF Key.Code = 65293 THEN IF TextBox2.Text = "" THEN Message("INGRESE UN VALOR") TextBox2.SetFocus ELSE TextBox3.SetFocus ENDIF ENDIF END
  • 5. 2.- CALCULADORA ' Gambas class file PUBLIC BAN AS Integer PUBLIC OP1 AS Float PUBLIC OP2 AS Float PUBLIC SUB Button1_Click() TextBox1.Text = TextBox1.Text & "1" END PUBLIC SUB Button2_Click( TextBox1.Text = TextBox1.Text & "2" END PUBLIC SUB Button3_Click() TextBox1.Text = TextBox1.Text & "3" END PUBLIC SUB Button6_Click() TextBox1.Text = TextBox1.Text & "4" END
  • 6. PUBLIC SUB Button7_Click() TextBox1.Text = TextBox1.Text & "5" END PUBLIC SUB Button8_Click() TextBox1.Text = TextBox1.Text & "6" END PUBLIC SUB Button11_Click() TextBox1.Text = TextBox1.Text & "7" END PUBLIC SUB Button9_Click() TextBox1.Text = TextBox1.Text & "8" END PUBLIC SUB Button10_Click() TextBox1.Text = TextBox1.Text & "9" END PUBLIC SUB Button4_Click() TextBox1.Text = TextBox1.Text & "0" END PUBLIC SUB Button5_Click() TextBox1.Text = TextBox1.Text & "00" END PUBLIC SUB Button18_Click() FMain.CLOSE END PUBLIC SUB Button17_Click() TextBox1.Text = TextBox1.Text & "." END PUBLIC SUB Button16_Click() BAN = 1 IF TextBox1.Text <> 0 THEN OP1 = TextBox1.Text ELSE OP1 = 0 ENDIF
  • 7. TextBox1.Clear END PUBLIC SUB Button19_Click() TextBox1.Text = "" END PUBLIC SUB Button15_Click() BAN = 2 IF TextBox1.Text <> 0 THEN OP1 = TextBox1.Text ELSE OP1 = 0 ENDIF TextBox1.Clear END PUBLIC SUB Button13_Click() BAN = 3 IF TextBox1.Text <> 0 THEN OP1 = TextBox1.Text ELSE OP1 = 0 ENDIF TextBox1.Clear END PUBLIC SUB Button12_Click() BAN = 4 IF TextBox1.Text <> 0 THEN OP1 = TextBox1.Text ELSE OP1 = 0 ENDIF TextBox1.Clear END PUBLIC SUB Button14_Click() IF TextBox1.Text <> 0 THEN OP2 = TextBox1.Text ELSE OP2 = 0 ENDIF TextBox1.Text = OPERACION(OP1, OP2, BAN)
  • 8. END PUBLIC FUNCTION OPERACION(V1 AS Float, V2 AS Float, OPER AS Float) AS Float DIM RE AS Float DIM X, Y, Z, X1, Y1, Z1, X2, Y2, Z2 AS Integer DIM valor, i AS Integer DIM cadena, cadena2 AS String DIM XX, MEA AS String SELECT CASE OPER CASE 1 RE = V1 + V2 Z2 = 1 CASE 2 RE = V1 - V2 Z2 = 1 CASE 3 RE = V1 * V2 Z2 = 1 CASE 4 RE = V1 / V2 Z2 = 1 CASE 5 RE = (V1 * V2) / 100 Z2 = 1 CASE 6 RE = V1 ^ V2 Z2 = 1 CASE 7 RE = V1 ^ 2 Z2 = 1 CASE 8 RE = V1 ^ 3 Z2 = 1 CASE 9 RE = 1 / V1 Z2 = 1 END SELECT IF Z2 = 1 RETURN RE ELSE RETURN Y1 ENDIF END PUBLIC SUB Button20_Click()
  • 9. BAN = 5 IF TextBox1.Text <> 0 THEN OP1 = TextBox1.Text ELSE OP1 = 0 ENDIF TextBox1.Clear END PUBLIC SUB Button21_Click() BAN = 6 IF TextBox1.Text <> 0 THEN OP1 = TextBox1.Text ELSE OP1 = 0 ENDIF TextBox1.Clear END PUBLIC SUB Button22_Click() BAN = 7 IF TextBox1.Text <> 0 THEN OP1 = TextBox1.Text ELSE OP1 = 0 ENDIF TextBox1.Text = OP1 END PUBLIC SUB Button23_Click() DIM valor, x1, x2, i AS Integer DIM cadena, cadena2 AS String valor = TextBox1.Text WHILE valor > 0 x1 = valor MOD 2 x2 = Int(valor / 2) cadena = cadena & Str(x1) valor = x2 WEND FOR i = Len(cadena) TO 1 STEP -1 cadena2 = cadena2 & (Mid(cadena, i, 1)) NEXT TextBox1.Text = cadena2
  • 10. END PUBLIC SUB Button25_Click() 'Calculo a octal de un número decimal DIM valor, x1, x2, i AS Integer DIM cadena, cadena2 AS String valor = TextBox1.Text WHILE valor > 0 x1 = valor MOD 16 x2 = Int(valor / 16) IF x1 = 10 THEN cadena = cadena & "A" ELSE IF x1 = 11 THEN cadena = cadena & "B" ELSE IF x1 = 12 THEN cadena = cadena & "C" ELSE IF x1 = 13 THEN cadena = cadena & "D" ELSE IF x1 = 14 THEN cadena = cadena & "E" ELSE IF x1 = 15 THEN cadena = cadena & "F" ELSE cadena = cadena & Str(x1) ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF valor = x2 WEND FOR i = Len(cadena) TO 1 STEP -1 cadena2 = cadena2 & (Mid(cadena, i, 1)) NEXT TextBox1.Text = cadena2 END PUBLIC SUB Button24_Click()
  • 11. 'Calculo a octal de un número decimal DIM valor, x1, x2, i AS Integer DIM cadena, cadena2 AS String valor = TextBox1.Text WHILE valor > 0 x1 = valor MOD 8 x2 = Int(valor / 8) cadena = cadena & Str(x1) valor = x2 WEND FOR i = Len(cadena) TO 1 STEP -1 cadena2 = cadena2 & (Mid(cadena, i, 1)) NEXT TextBox1.Text = cadena2 END PUBLIC SUB Button29_Click() TextBox1.Text = TextBox1.Text ^ 3 END PUBLIC SUB Button27_Click() TextBox1.Text = 1 / TextBox1.Text END PUBLIC SUB Button26_Click() ' DIM N AS Float IF TextBox1.Text = "" THEN Message("INGRESE DATO") ' ELSE ' IF RadioButton1.Value = TRUE THEN ' N = Str(Sin(Val(TextBox1.Text))) ' TextBox1.Text = N ' RadioButton2.Value = FALSE ELSE ' IF RadioButton2.Value = TRUE THEN TextBox1.Text = Sin(Pi * (Val(TextBox1.Text)) / 180) ' ENDIF ' ENDIF ENDIF END PUBLIC SUB Button31_Click() ' DIM N AS Float ' N = Cos(TextBox1.Text)
  • 12. ' TextBox1.Text = N IF TextBox1.Text = "" THEN Message("INGRESE DATO") ELSE TextBox1.Text = Cos(Pi * (Val(TextBox1.Text)) / 180) ENDIF END PUBLIC SUB Button30_Click() IF TextBox1.Text = "" THEN Message("INGRESE DATO") ELSE TextBox1.Text = Tan(Pi * (Val(TextBox1.Text)) / 180) ENDIF END PUBLIC SUB Button28_Click() DIM FAC, N AS Float N = TextBox1.Text FAC = 1 WHILE (N <> 0) FAC = FAC * N N=N-1 TextBox1.Text = FAC WEND END
  • 13. 3.- PORCENTAJE DE UN PRODUCTO PUBLIC SUB Main() DIM A AS Integer DIM B AS Integer DIM C AS Integer DIM T AS Integer DIM PM AS Float DIM PC AS Float DIM PO AS Float A = 300 B = 400 C = 800 T=A+B+C PM = (300 * 100) / T PC = (400 * 100) / T PO = (800 * 100) / T
  • 14. PRINT "EL TOTAL ES...." PRINT T PRINT "EL PORCENTAJE DE MAIZ ES...." PRINT PM & "%" PRINT "EL PORCENTAJE DE CAFE ES...." PRINT PC & "%" PRINT "EL PORCENTAJE DE CACAO ES...." PRINT PO & "%" END 4.- REALIZAR UN CÍRCULO PUBLIC r AS Integer PUBLIC pox AS Integer PUBLIC poy AS Integer PUBLIC SUB _new()
  • 15. END PUBLIC SUB Form_Open() r = 30 END PUBLIC SUB Button1_Click() area1.Clear pox = area1.Height / 2 poy = area1.Width / 2 Draw.Begin(area1) Draw.FillColor = Color.RGB(200, 190, 50) Draw.FillStyle = Fill.BackDiagonal Draw.FillStyle = Fill.Dense37 Draw.Circle(pox, poy, r) r = r + 10 Draw.End END PUBLIC SUB Button3_Click() ME.Close END PUBLIC SUB Button2_Click() area1.Clear pox = area1.Height / 2 poy = area1.Width / 2 Draw.Begin(area1) Draw.FillColor = Color.RGB(200, 190, 50) Draw.FillStyle = Fill.Vertical Draw.FillStyle = Fill.Cross Draw.Circle(pox, poy, r) r = r - 10 Draw.End END PUBLIC SUB Button4_Click() DIM n1, n2, n3 AS Integer RANDOMIZE n1 = Int(Rnd() * 1000) ' TextBox1.Text = n1 area1.Clear pox = area1.Height / 2 poy = area1.Width / 2
  • 16. Draw.Begin(area1) Draw.FillColor = Color.RGB(200, 190, 50) Draw.FillStyle = Fill.CrossDiagonal Draw.FillStyle = Fill.Cross Draw.Circle(pox, poy, n1) Draw.Ellipse(pox, poy, n1, n1) r = r - 10 n2 = Int(Rnd() * 10) Draw.Ellipse(pox, poy, n2, n2) Draw.Line(pox, poy, n2, n2) Draw.Rect(pox, poy, n2) n3 = Int(Rnd() * 10) END 5.- PROTECTOR DE PANTALLA
  • 17. ' Gambas class file PUBLIC SUB Form_Open() Timer1.Enabled = TRUE Timer2.Enabled = TRUE Timer3.Enabled = TRUE Timer4.Enabled = TRUE Timer5.Enabled = TRUE END PUBLIC SUB Timer1_Timer() DIM c1, c2, c, posy, posx AS Integer C1 = Int(Rnd() * 700) C2 = Int(Rnd() * 700) C = Int(Rnd() * 20) posy = Area1.Height / 2 posx = Area1.Width / 2 Draw.Begin(area1) Draw.FillColor = Color.RGB((160 + c1), (2 + c2), (c1 + C2)) ' coge los colores que se designen Draw.FillStyle = Fill.Solid Draw.Circle(posy, C2, C) Draw.End END PUBLIC SUB Button1_Click() ME.Close END
  • 18. PUBLIC SUB Timer2_Timer() DIM c1, c2, c AS Integer C1 = Int(Rnd() * 1000) C2 = Int(Rnd() * 1000) C = Int(Rnd() * 400) ' posy = Area1.Height / 2 ' posx = Area1.Width / 2 Draw.Begin(area1) Draw.FillColor = Color.RGB((160 + c1), (2 + c2), (c1 + C2)) ' coge los colores que se designen Draw.FillStyle = Fill.Diagonal Draw.Ellipse(C1, C2, C, c) Draw.End END PUBLIC SUB Timer3_Timer() DIM c1, c2, c AS Integer C1 = Int(Rnd() * 600) C2 = Int(Rnd() * 600) C = Int(Rnd() * 40) ' posy = Area1.Height / 2 ' posx = Area1.Width / 2 Draw.Begin(area1) Draw.FillColor = Color.RGB((300 + c1), (7 + c2), (c1 + C2)) ' coge los colores que se designen Draw.FillStyle = Fill.Dense94 Draw.Line(C1, C2, C, c) Draw.End END PUBLIC SUB Timer4_Timer() DIM c1, c2, c, r AS Integer C1 = Int(Rnd() * 600) C2 = Int(Rnd() * 600) C = Int(Rnd() * 40) ' posy = Area1.Height / 2 ' posx = Area1.Width / 2 Draw.Begin(area1) Draw.FillColor = Color.RGB((200 + c1), (5 + c2), (c1 + C2)) ' coge los colores que se designen Draw.FillStyle = Fill.Dense94 Draw.Rect(C1, C2, c, c) Draw.End
  • 19. END PUBLIC SUB Timer5_Timer() DIM c1, c2, c, r AS Integer IF Timer5.Delay > 10 THEN Area1.Clear TextBox2.Text = "" TextBox2.Text = Timer ELSE C1 = Int(Rnd() * 600) C2 = Int(Rnd() * 600) C = Int(Rnd() * 40) ' posy = Area1.Height / 2 ' posx = Area1.Width / 2 Draw.Begin(area1) Draw.FillColor = Color.RGB((200 + c1), (5 + c2), (c1 + C2)) ' coge los colores que se designen Draw.FillStyle = Fill.Dense94 'Draw.Polygon(C1, C2) Draw.End TextBox2.Text = Timer ENDIF END 6.- RELOJ DIGITAL
  • 20. PUBLIC SUB Form_Open() timer1.Enabled = TRUE END PUBLIC SUB Timer1_Timer() timer1.Delay = 1000 TextLabel1.Text = Time(Hour(Now), Minute(Now), Second(Now)) END PUBLIC SUB Button1_Click() Message.Info("Es facil programar en Gambas") ME.CLOSE END PUBLIC SUB Button2_Click() Message.Delete("Ejemplo de Reloj Digital ") END PUBLIC SUB Form_Activate() TextBox1.text = TextLabel1.Text = Time(Hour(Now)) END
  • 21. 7.- VERIFICADOR DE # DE CEDULA PUBLIC SUB Main() DIM NUM_CED, NOMBRE AS String DIM A, B, C, D, E, F, G, H, I, J, K, L AS Integer PRINT "INGRESE SU NOMBRE" INPUT NOMBRE PRINT "INGRESE NUMERO DE CEDULA" INPUT NUM_CED FOR A = 1 TO 9 STEP 1 B = Str(Mid(NUM_CED, A, 1)) C = A MOD 2 IF C = 0 THEN H=H+B ELSE
  • 22. G=B*2 IF G > 9 THEN C = G MOD 10 D = Int(G / 10) E=C+D ELSE E=G ENDIF F=F+E ENDIF NEXT I=F+H J = I MOD 10 K = 10 - J L = Mid(NUM_CED, 1, 9) PRINT "EL NUMERO DE SU CEDULA ES...." & Str(L) & "-" & Str(K) END 8.- UTILIZACION DE FUNCIONES
  • 23. ' Gambas module file PRIVATE heroe AS superheroe PRIVATE heroe1 AS superheroe PRIVATE heroe2 AS superheroe 'atributos PUBLIC SUB Main() ' DIM heroe AS superheroe ' DIM heroe1 AS superheroe heroe = NEW superheroe heroe1 = NEW superheroe heroe2 = NEW superheroe heroe.nombre = "AQUILES MEJIA" heroe.actor = "DRAGON BALL Z " heroe.habilidad = "JENQUI DAMA " heroe.imprime() heroe1.nombre = "EDUARDO MEJIA " heroe1.actor = "SUPERMAN " heroe1.habilidad = "BOLAR POR LOS AIRES" heroe1.imprime() WITH heroe2 .nombre = "Zorro"
  • 24. .actor = "Antonio Bandera" .habilidad = "Peliar Con La Espada" .imprime() END WITH END PUBLIC nombre AS String PUBLIC actor AS String PUBLIC habilidad AS String PUBLIC FUNCTION imprime() 'PRINT "Hola mi nombre es: " & Str(nombre) & " Mi personaje favorito es: " & Str(actor) & " Y su habilidad es: " & Str(habilidad) PRINT "Hola mi nombre es: " & nombre & " Mi personaje favorito es: " & actor & " Y su habilidad es: " & habilidad END
  • 25. 9.- CONVERTIDOR DE NUMEROS A LETRAS ' Gambas class file PUBLIC FUNCTION EnLetras(numero AS String) AS String DIM b, paso AS Integer DIM expresion, entero, deci, flag AS String flag = "N" FOR paso = 1 TO Len(numero) IF Mid(numero, paso, 1) = "." THEN flag = "S" ELSE IF flag = "N" THEN entero = entero & Mid(numero, paso, 1) 'Extae la parte entera del numero ELSE deci = deci & Mid(numero, paso, 1) 'Extrae la parte decimal del numero END IF END IF NEXT ' paso
  • 26. IF Len(deci) = 1 THEN deci = deci & "0" END IF flag = "N" IF Val(numero) >= -999999999 AND Val(numero) <= 999999999 THEN 'si el numero esta dentro de 0 a 999.999.999 FOR paso = Len(entero) TO 1 STEP -1 b = Len(entero) - (paso - 1) SELECT CASE paso CASE 3, 6, 9 SELECT CASE Mid(entero, b, 1) CASE "1" IF Mid(entero, b + 1, 1) = "0" AND Mid(entero, b + 2, 1) = "0" THEN expresion = expresion & "Cien " ELSE expresion = expresion & "Ciento " END IF CASE "2" expresion = expresion & "Doscientos " CASE "3" expresion = expresion & "Trescientos " CASE "4" expresion = expresion & "Cuatrocientos " CASE "5" expresion = expresion & "Quinientos " CASE "6" expresion = expresion & "Seiscientos " CASE "7" expresion = expresion & "Setecientos " CASE "8" expresion = expresion & "Ochocientos " CASE "9" expresion = expresion & "Novecientos " END SELECT CASE 2, 5, 8 SELECT CASE Mid(entero, b, 1) CASE "1" IF Mid(entero, b + 1, 1) = "0" THEN flag = "S" expresion = expresion & "Diez " END IF IF Mid(entero, b + 1, 1) = "1" THEN flag = "S"
  • 27. expresion = expresion & "Once " END IF IF Mid(entero, b + 1, 1) = "2" THEN flag = "S" expresion = expresion & "Doce " END IF IF Mid(entero, b + 1, 1) = "3" THEN flag = "S" expresion = expresion & "Trece " END IF IF Mid(entero, b + 1, 1) = "4" THEN flag = "S" expresion = expresion & "Catorce " END IF IF Mid(entero, b + 1, 1) = "5" THEN flag = "S" expresion = expresion & "Quince " END IF IF Mid(entero, b + 1, 1) > "5" THEN flag = "N" expresion = expresion & "Dieci" END IF CASE "2" IF Mid(entero, b + 1, 1) = "0" THEN expresion = expresion & "Veinte " flag = "S" ELSE expresion = expresion & "Veinti" flag = "N" END IF CASE "3" IF Mid(entero, b + 1, 1) = "0" THEN expresion = expresion & "Treinta " flag = "S" ELSE expresion = expresion & "Treinta y " flag = "N" END IF CASE "4" IF Mid(entero, b + 1, 1) = "0" THEN expresion = expresion & "Cuarenta "
  • 28. flag = "S" ELSE expresion = expresion & "Cuarenta y " flag = "N" END IF CASE "5" IF Mid(entero, b + 1, 1) = "0" THEN expresion = expresion & "Cincuenta " flag = "S" ELSE expresion = expresion & "Cincuenta y " flag = "N" END IF CASE "6" IF Mid(entero, b + 1, 1) = "0" THEN expresion = expresion & "Sesenta " flag = "S" ELSE expresion = expresion & "Sesenta y " flag = "N" END IF CASE "7" IF Mid(entero, b + 1, 1) = "0" THEN expresion = expresion & "Setenta " flag = "S" ELSE expresion = expresion & "Setenta y " flag = "N" END IF CASE "8" IF Mid(entero, b + 1, 1) = "0" THEN expresion = expresion & "Ochenta " flag = "S" ELSE expresion = expresion & "Ochenta y " flag = "N" END IF CASE "9" IF Mid(entero, b + 1, 1) = "0" THEN
  • 29. expresion = expresion & "Noventa " flag = "S" ELSE expresion = expresion & "Noventa y " flag = "N" END IF END SELECT CASE 1, 4, 7 SELECT CASE Mid(entero, b, 1) CASE "1" IF flag = "N" THEN IF paso = 1 THEN expresion = expresion & "Uno " ELSE expresion = expresion & "Un " END IF END IF CASE "2" IF flag = "N" THEN expresion = expresion & "Dos " END IF CASE "3" IF flag = "N" THEN expresion = expresion & "Tres " END IF CASE "4" IF flag = "N" THEN expresion = expresion & "Cuatro " END IF CASE "5" IF flag = "N" THEN expresion = expresion & "Cinco " END IF CASE "6" IF flag = "N" THEN expresion = expresion & "Seis " END IF CASE "7" IF flag = "N" THEN expresion = expresion & "Siete " END IF CASE "8"
  • 30. IF flag = "N" THEN expresion = expresion & "Ocho " END IF CASE "9" IF flag = "N" THEN expresion = expresion & "Nueve " END IF END SELECT END SELECT IF paso = 4 THEN IF Mid(entero, 6, 1) <> "0" OR Mid(entero, 5, 1) <> "0" OR Mid(entero, 4, 1) <> "0" OR (Mid(entero, 6, 1) = "0" AND Mid(entero, 5, 1) = "0" AND Mid(entero, 4, 1) = "0" AND Len(entero) <= 6) THEN expresion = expresion & "mil " END IF END IF IF paso = 7 THEN IF Len(entero) = 7 AND Mid(entero, 1, 1) = "1" THEN expresion = expresion & "Millón " ELSE expresion = expresion & "Millones " END IF END IF NEXT ' paso IF deci <> "" THEN IF Mid(entero, 1, 1) = "-" THEN 'si el numero es negativo expresion = "menos " & expresion & "con " & deci & "/100" ELSE expresion = expresion & "con " & deci & "/100" END IF ELSE IF Mid(entero, 1, 1) = "-" THEN 'si el numero es negativo expresion = "menos " & expresion ELSE expresion = expresion END IF END IF ELSE 'si el numero a convertir esta fuera del rango superior e inferior expresion = "" END IF TextBox2.Text = expresion END FUNCTION
  • 31. PUBLIC SUB Button1_Click() ME.Close END PUBLIC SUB TextBox1_KeyPress() IF Key.Code = 65293 THEN EnLetras(TextBox1.Text) ENDIF END 10.- ENCONTRAR EL MAYOR, MENOR, INTERMEDIO DE UN NÚMERO
  • 32. ' Gambas module file 'entre tres numeros distintos mayor medio menor igual PUBLIC SUB Main() DIM a, b, c AS Integer a = 15 b = 100 c = 22 IF a > b AND a > c THEN PRINT "El mayor es...:" & Str(a) IF b > c THEN PRINT "El intermedio es...:" & Str(b) PRINT "El menor es...:" & Str(c) ELSE PRINT "El intermedio es...:" & Str(c) PRINT "El menor es...:" & Str(b) ENDIF ELSE IF b > c THEN PRINT "El mayor es...:" & Str(b) IF a > c THEN PRINT "El intermedio es...:" & Str(a) PRINT "El menor es...:" & Str(c) ELSE PRINT "El intermedio es...:" & Str(c)
  • 33. PRINT "El menor es...:" & Str(a) ENDIF ELSE PRINT "El mayor es...:" & Str(c) IF a > b THEN PRINT "El intermedio es...:" & Str(a) PRINT "El menor es...:" & Str(b) ELSE PRINT "El intermedio es...:" & Str(b) PRINT "El menor es...:" & Str(a) ENDIF ENDIF ENDIF END 11.- CRONOMETRO
  • 34. Gambas class file PUBLIC SUB Timer1_Timer() SEG.Text = Val(SEG.Text) + 1 IF SEG.Text = 60 THEN MIN.Text = Val(MIN.Text) + 1 SEG.Text = 0 ENDIF IF MIN.Text = 60 THEN HOR.Text = Val(HOR.Text) + 1 MIN.Text = 0 ENDIF IF HOR.Text = 24 THEN HOR.Text = 0 ENDIF END PUBLIC SUB Button1_Click() IF Button1.Text = "INICIAR" THEN Timer1.Enabled = TRUE Button1.Caption = "PARAR" ELSE IF Button1.Text = "PARAR" THEN Timer1.Enabled = FALSE Button1.Caption = "INICIAR" ENDIF ENDIF END PUBLIC SUB Button2_Click() Me.close END