Ejercicios en gambas ' Gambas class file PUBLIC BAN AS Integer PUBLIC OP1 AS Float PUBLIC OP2 AS Float PUBLIC SUB _new() E...
PUBLIC SUB Button15_Click() BAN = 2  IF TextBox1.Text <> 0 THEN  OP1 = TextBox1.Text ELSE  OP1 = 0 ENDIF  TextBox1.Clear E...
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...
FOR i = Len(cadena) TO 1 STEP -1 cadena2 = cadena2 & (Mid(cadena, i, 1)) NEXT  TextBox1.Text = cadena2  END PUBLIC SUB But...
FOR i = Len(cadena) TO 1 STEP -1 cadena2 = cadena2 & (Mid(cadena, i, 1)) NEXT  TextBox1.Text = cadena2  END PUBLIC SUB But...
 
DE LETRAS A NUMEROS   ' Gambas class file PUBLIC SUB _new() END PUBLIC SUB Form_Open() END  PUBLIC FUNCTION EnLetras(numer...
IF Len(deci) = 1 THEN  deci = deci & &quot;0&quot;  END IF  flag = &quot;N&quot;  IF Val(numero) >= -999999999 AND Val(num...
CASE &quot;4&quot;  expr = expr & &quot;cuatrocientos &quot;  CASE &quot;5&quot;  expr = expr & &quot;quinientos &quot;  C...
IF Mid(entero, b + 1, 1) = &quot;2&quot; THEN  flag = &quot;S&quot;  expr = expr & &quot;doce &quot;  END IF  IF Mid(enter...
ELSE  expr = expr & &quot;veinti&quot;  flag = &quot;N&quot;  END IF  CASE &quot;3&quot;  IF Mid(entero, b + 1, 1) = &quot...
ELSE  expr = expr & &quot;cincuenta y &quot;  flag = &quot;N&quot;  END IF  CASE &quot;6&quot;  IF Mid(entero, b + 1, 1) =...
ELSE  expr = expr & &quot;ochenta y &quot;  flag = &quot;N&quot;  END IF  CASE &quot;9&quot;  IF Mid(entero, b + 1, 1) = &...
CASE &quot;2&quot;  IF flag = &quot;N&quot; THEN  expr = expr & &quot;dos &quot;  END IF  CASE &quot;3&quot;  IF flag = &q...
CASE &quot;8&quot;  IF flag = &quot;N&quot; THEN  expr = expr & &quot;ocho &quot;  END IF  CASE &quot;9&quot;  IF flag = &...
NEXT  '  paso  IF deci <> &quot;&quot; THEN  IF Mid(entero, 1, 1) = &quot;-&quot; THEN 'si el numero es negativo  expr = &...
Al terminar tendremos una pantalla así:
CALCULAR EL DIGITO VERIFICADOR DE CEDULA ' Gambas module file PUBLIC SUB Main() DIM NUM_CED, NOMBRE AS String DIM A, B, C,...
'EL ECUADOR EXPORTA CAFE, CACAO Y MAIZ.SE DESEA CALCULAR EL TOTAL DE QUINTALES EXPORTADOS  'Y EL PORCENTAJE DE CADA PRODUC...
SERIE FIBONACCI   PUBLIC SUB Main() DIM p, s, t, x AS Integer DIM fibo AS String p = 0 s = 1 fibo = Str(p) & Str(s) WHILE ...
LLAMADO FUNCION SUMA RESTA MULTIPLICACION DIVISION PUBLIC SUB Main() DIM a, b, h, z AS Integer PRINT &quot;ingrese primer ...
d = v1 / v2 PRINT &quot;la division es;....&quot;, d  END i ngrese primer valor 5 ingrese segundo valor 2 la suma es;.... ...
PRINT &quot;la resta de los numeros:......&quot;, funciones2.resta(a, b) PRINT &quot;la multiplicacion de los numeros:.......
PUBLIC SUB resta(v1 AS Integer, v2 AS Integer) AS Integer DIM r AS Integer r = v1 - v2 RETURN r END  PUBLIC SUB multiplica...
FACTURA   PUBLIC i AS Integer PUBLIC r AS Integer PUBLIC m AS Integer PUBLIC SUB Form_Open()  Textbox1.SetFocus  GridView1...
PUBLIC SUB Button2_Click() TextBox1.Text = m  TextBox2.Text = (m * 7) / 100  TextBox3.Text = ((((TextBox1.Text) - (TextBox...
ENDIF  END PUBLIC SUB TextBox7_KeyPress() IF Key.Code = 65293 THEN IF TextBox7.Text = &quot;&quot; THEN  Message.Info(&quo...
 
OBTENER N{UMERO MAYOR MEDIO Y MENOR   PUBLIC SUB Main() DIM a, b, c AS Integer a = 15 b = 100 c = 22 IF a > b AND a > c TH...
PRINT &quot;El intermedio  es...:&quot; & Str(c) PRINT &quot;El menor es...:&quot; & Str(a)  ENDIF ELSE  PRINT &quot;El ma...
NUMERO MAYOR DE TRES NUMEROS DADOS   PRINT &quot;INGRESE PRIMER VALOR&quot; INPUT A PRINT &quot;INGRESE SEGUNDO VALOR&quot...
OBJETOS    PRIVATE heroe1 AS NEW superheroe PRIVATE heroe2 AS NEW superheroe PRIVATE heroe3 AS NEW superheroe PUBLIC SUB M...
PUBLIC FUNCTION imprime()  PRINT &quot;hola el nombre de mi actor favorito es:..&quot; & Str(nombre) & &quot; 
 mi persona...
OPERRACION SUMA PUBLIC SUB Main() DIM A AS Integer DIM B AS Integer DIM S AS Integer A = 12 B = 32 S = A + B PRINT &quot;L...
OPERACIONES BÁSICAS PUBLIC SUB Button1_Click() TextBox3.Text = TextBox1.Text + TextBox2.Text END PUBLIC SUB Button2_Click(...
PROTECTOR DE PANTALLA PUBLIC SUB Form_Open() Timer1.Enabled = TRUE Timer2.Enabled = TRUE Timer3.Enabled = TRUE Timer4.Enab...
END PUBLIC SUB Timer2_Timer() DIM c1, c2, c AS Integer C1 = Int(Rnd() * 1000) C2 = Int(Rnd() * 1000) C = Int(Rnd() * 400) ...
PUBLIC SUB Timer4_Timer() DIM c1, c2, c, r AS Integer C1 = Int(Rnd() * 600) C2 = Int(Rnd() * 600) C = Int(Rnd() * 40) Draw...
 
TABLA DE MULTIPLICAR PUBLIC SUB Main() DIM A, T, N, I AS Integer PRINT &quot;INGRESE TABLA&quot; INPUT T PRINT &quot;INGRE...
UNION DE CADENAS ' Gambas class file PRIVATE marca AS String PRIVATE modelo AS String PRIVATE tipo AS String PRIVATE calif...
PUBLIC FUNCTION descripcion() AS String  RETURN marca & &quot;  &quot; & modelo & &quot;  &quot; & tipo & &quot;  &quot; &...
JUEGO DE AZAR RANDOMICOS ' Gambas class file PUBLIC SUB _new() END PUBLIC SUB Form_Open() Label1.Text = &quot;INGRESE CANT...
TextBox3.Text = N3 A = 1 B = 2 C = 3 D = 4 E = 5 F = 6 G = 7 H = 8 I = 9 J = 10 IF (TextBox1.Text = TextBox2.Text) AND (Te...
IF TextBox1.Text = C AND TextBox2.Text = C AND TextBox3.Text = C THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Te...
Message(&quot;GANASTE&quot;)  TextBox4.Text = &quot;0&quot; ELSE  IF TextBox1.Text = H AND TextBox2.Text = H AND TextBox3....
ENDIF  ENDIF  ENDIF  ENDIF ENDIF ELSE  TextBox5.Text = Val(TextBox5.Text) - Val(TextBox4.Text) Message(&quot;PERDISTE&quot...
TextBox3.Text = N3 A = 1 B = 2 C = 3 D = 4 E = 5 F = 6 G = 7 H = 8 I = 9 J = 10 ' IF TextBox1.Text = &quot;&quot;  ' ELSE ...
TextBox4.Text = &quot;0&quot; ELSE  IF TextBox1.Text = C AND TextBox2.Text = C AND TextBox3.Text = C THEN TextBox5.Text = ...
IF TextBox1.Text = G AND TextBox2.Text = G AND TextBox3.Text = G THEN  TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.T...
 
RELOJ DIGITAL ' Gambas class file PUBLIC SUB Form_Open() timer1.Enabled = TRUE END PUBLIC SUB Timer1_Timer() timer1.Delay ...
CRONOMETRO ' Gambas class file PUBLIC SUB Timer1_Timer() SEG.Text = Val(SEG.Text) + 1 IF SEG.Text = 60 THEN  MIN.Text = Va...
Upcoming SlideShare
Loading in …5
×

Ejemplo En Gambas

2,525 views

Published on

Published in: Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,525
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
33
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Ejemplo En Gambas

  1. 1. Ejercicios en gambas ' Gambas class file PUBLIC BAN AS Integer PUBLIC OP1 AS Float PUBLIC OP2 AS Float PUBLIC SUB _new() END PUBLIC SUB Form_Open() END PUBLIC SUB Button1_Click() TextBox1.Text = TextBox1.Text & &quot;1&quot; END PUBLIC SUB Button2_Click() TextBox1.Text = TextBox1.Text & &quot;2&quot; END PUBLIC SUB Button3_Click() TextBox1.Text = TextBox1.Text & &quot;3&quot; END PUBLIC SUB Button6_Click() TextBox1.Text = TextBox1.Text & &quot;4&quot; END PUBLIC SUB Button7_Click() TextBox1.Text = TextBox1.Text & &quot;5&quot; END CALCULADORA PUBLIC SUB Button8_Click() TextBox1.Text = TextBox1.Text & &quot;6&quot; END PUBLIC SUB Button11_Click() TextBox1.Text = TextBox1.Text & &quot;7&quot; END PUBLIC SUB Button9_Click() TextBox1.Text = TextBox1.Text & &quot;8&quot; END PUBLIC SUB Button10_Click() TextBox1.Text = TextBox1.Text & &quot;9&quot; END PUBLIC SUB Button5_Click() TextBox1.Text = TextBox1.Text & &quot;00&quot; END PUBLIC SUB Button18_Click() FMain.CLOSE END PUBLIC SUB Button17_Click() TextBox1.Text = TextBox1.Text & &quot;.&quot; ENDPUBLIC SUB Button4_Click() TextBox1.Text = TextBox1.Text & &quot;0&quot; 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 = &quot;&quot; END
  2. 2. 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
  3. 3. 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
  4. 4. 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 & &quot;A&quot; ELSE IF x1 = 11 THEN cadena = cadena & &quot;B&quot; ELSE IF x1 = 12 THEN cadena = cadena & &quot;C&quot; ELSE IF x1 = 13 THEN cadena = cadena & &quot;D&quot; ELSE IF x1 = 14 THEN cadena = cadena & &quot;E&quot; ELSE IF x1 = 15 THEN cadena = cadena & &quot;F&quot; 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
  5. 5. FOR i = Len(cadena) TO 1 STEP -1 cadena2 = cadena2 & (Mid(cadena, i, 1)) NEXT TextBox1.Text = cadena2 END PUBLIC SUB Button29_Click() BAN = 8 IF TextBox1.Text <> 0 THEN OP1 = TextBox1.Text ELSE OP1 = 0 ENDIF TextBox1.Text = OP1 END PUBLIC SUB Button27_Click() BAN = 9 IF TextBox1.Text <> 0 THEN OP1 = TextBox1.Text ELSE OP1 = 0 ENDIF TextBox1.Text = OP1 END PUBLIC SUB Button26_Click() IF TextBox1.Text = &quot;&quot; THEN Message(&quot;INGRESE DATO&quot;) ELSE TextBox1.Text = Sin(Pi * (Val(TextBox1.Text)) / 180) RadioButton1.Value = FALSE ENDIF END PUBLIC SUB Button31_Click() IF TextBox1.Text = &quot;&quot; THEN Message(&quot;INGRESE DATO&quot;) ELSE TextBox1.Text = Cos(Pi * (Val(TextBox1.Text)) / 180) ENDIF END PUBLIC SUB Button30_Click() IF TextBox1.Text = &quot;&quot; THEN Message(&quot;INGRESE DATO&quot;) 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
  6. 7. DE LETRAS A NUMEROS   ' Gambas class file PUBLIC SUB _new() END PUBLIC SUB Form_Open() END PUBLIC FUNCTION EnLetras(numero AS String) AS String DIM b, paso AS Integer DIM expr, entero, deci, flag AS String flag = &quot;N&quot; FOR paso = 1 TO Len(numero) IF Mid(numero, paso, 1) = &quot;.&quot; THEN flag = &quot;S&quot; ELSE IF flag = &quot;N&quot; THEN entero = entero & Mid(numero, paso, 1) ELSE deci = deci & Mid(numero, paso, 1) END IF END IF NEXT
  7. 8. IF Len(deci) = 1 THEN deci = deci & &quot;0&quot; END IF flag = &quot;N&quot; 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 &quot;1&quot; IF Mid(entero, b + 1, 1) = &quot;0&quot; AND Mid(entero, b + 2, 1) = &quot;0&quot; THEN expr = expr & &quot;cien &quot; ELSE expr = expr & &quot;ciento &quot; END IF CASE &quot;2&quot; expr = expr & &quot;doscientos &quot; CASE &quot;3&quot; expr = expr & &quot;trescientos &quot;
  8. 9. CASE &quot;4&quot; expr = expr & &quot;cuatrocientos &quot; CASE &quot;5&quot; expr = expr & &quot;quinientos &quot; CASE &quot;6&quot; expr = expr & &quot;seiscientos &quot; CASE &quot;7&quot; expr = expr & &quot;setecientos &quot; CASE &quot;8&quot; expr = expr & &quot;ochocientos &quot; CASE &quot;9&quot; expr = expr & &quot;novecientos &quot; END SELECT CASE 2, 5, 8 SELECT CASE Mid(entero, b, 1) CASE &quot;1&quot; IF Mid(entero, b + 1, 1) = &quot;0&quot; THEN flag = &quot;S&quot; expr = expr & &quot;diez &quot; END IF IF Mid(entero, b + 1, 1) = &quot;1&quot; THEN flag = &quot;S&quot; expr = expr & &quot;once &quot; END IF
  9. 10. IF Mid(entero, b + 1, 1) = &quot;2&quot; THEN flag = &quot;S&quot; expr = expr & &quot;doce &quot; END IF IF Mid(entero, b + 1, 1) = &quot;3&quot; THEN flag = &quot;S&quot; expr = expr & &quot;trece &quot; END IF IF Mid(entero, b + 1, 1) = &quot;4&quot; THEN flag = &quot;S&quot; expr = expr & &quot;catorce &quot; END IF IF Mid(entero, b + 1, 1) = &quot;5&quot; THEN flag = &quot;S&quot; expr = expr & &quot;quince &quot; END IF IF Mid(entero, b + 1, 1) > &quot;5&quot; THEN flag = &quot;N&quot; expr = expr & &quot;dieci&quot; END IF CASE &quot;2&quot; IF Mid(entero, b + 1, 1) = &quot;0&quot; THEN expr = expr & &quot;veinte &quot; flag = &quot;S&quot;
  10. 11. ELSE expr = expr & &quot;veinti&quot; flag = &quot;N&quot; END IF CASE &quot;3&quot; IF Mid(entero, b + 1, 1) = &quot;0&quot; THEN expr = expr & &quot;treinta &quot; flag = &quot;S&quot; ELSE expr = expr & &quot;treinta y &quot; flag = &quot;N&quot; END IF CASE &quot;4&quot; IF Mid(entero, b + 1, 1) = &quot;0&quot; THEN expr = expr & &quot;cuarenta &quot; flag = &quot;S&quot; ELSE expr = expr & &quot;cuarenta y &quot; flag = &quot;N&quot; END IF CASE &quot;5&quot; IF Mid(entero, b + 1, 1) = &quot;0&quot; THEN expr = expr & &quot;cincuenta &quot; flag = &quot;S&quot;
  11. 12. ELSE expr = expr & &quot;cincuenta y &quot; flag = &quot;N&quot; END IF CASE &quot;6&quot; IF Mid(entero, b + 1, 1) = &quot;0&quot; THEN expr = expr & &quot;sesenta &quot; flag = &quot;S&quot; ELSE expr = expr & &quot;sesenta y &quot; flag = &quot;N&quot; END IF CASE &quot;7&quot; IF Mid(entero, b + 1, 1) = &quot;0&quot; THEN expr = expr & &quot;setenta &quot; flag = &quot;S&quot; ELSE expr = expr & &quot;setenta y &quot; flag = &quot;N&quot; END IF CASE &quot;8&quot; IF Mid(entero, b + 1, 1) = &quot;0&quot; THEN expr = expr & &quot;ochenta &quot; flag = &quot;S&quot;
  12. 13. ELSE expr = expr & &quot;ochenta y &quot; flag = &quot;N&quot; END IF CASE &quot;9&quot; IF Mid(entero, b + 1, 1) = &quot;0&quot; THEN expr = expr & &quot;noventa &quot; flag = &quot;S&quot; EL SE expr = expr & &quot;noventa y &quot; flag = &quot;N&quot; END IF END SELECT CASE 1, 4, 7 SELECT CASE Mid(entero, b, 1) CASE &quot;1&quot; IF flag = &quot;N&quot; THEN IF paso = 1 THEN expr = expr & &quot;uno &quot; ELSE expr = expr & &quot;un &quot; END IF END IF
  13. 14. CASE &quot;2&quot; IF flag = &quot;N&quot; THEN expr = expr & &quot;dos &quot; END IF CASE &quot;3&quot; IF flag = &quot;N&quot; THEN expr = expr & &quot;tres &quot; END IF CASE &quot;4&quot; IF flag = &quot;N&quot; THEN expr = expr & &quot;cuatro &quot; END IF CASE &quot;5&quot; IF flag = &quot;N&quot; THEN expr = expr & &quot;cinco &quot; END IF CASE &quot;6&quot; IF flag = &quot;N&quot; THEN expr = expr & &quot;seis &quot; END IF CASE &quot;7&quot; IF flag = &quot;N&quot; THEN expr = expr & &quot;siete &quot; END IF
  14. 15. CASE &quot;8&quot; IF flag = &quot;N&quot; THEN expr = expr & &quot;ocho &quot; END IF CASE &quot;9&quot; IF flag = &quot;N&quot; THEN expr = expr & &quot;nueve &quot; END IF END SELECT END SELECT IF paso = 4 THEN IF Mid(entero, 6, 1) <> &quot;0&quot; OR Mid(entero, 5, 1) <> &quot;0&quot; OR Mid(entero, 4, 1) <> &quot;0&quot; OR (Mid(entero, 6, 1) = &quot;0&quot; AND Mid(entero, 5, 1) = &quot;0&quot; AND Mid(entero, 4, 1) = &quot;0&quot; AND Len(entero) <= 6) THEN expr = expr & &quot;mil &quot; END IF END IF IF paso = 7 THEN IF Len(entero) = 7 AND Mid(entero, 1, 1) = &quot;1&quot; THEN expr = expr & &quot;millón &quot; ELSE expr = expr & &quot;millones &quot; END IF END IF
  15. 16. NEXT ' paso IF deci <> &quot;&quot; THEN IF Mid(entero, 1, 1) = &quot;-&quot; THEN 'si el numero es negativo expr = &quot;menos &quot; & expr & &quot;con &quot; & deci & &quot;/100&quot; ELSE expr = expr & &quot;con &quot; & deci & &quot;/100&quot; END IF ELSE IF Mid(entero, 1, 1) = &quot;-&quot; THEN 'si el numero es negativo expr = &quot;menos &quot; & expr ELSE expr = expr END IF END IF ELSE 'si el numero a convertir esta fuera del rango superior e inferior expr = &quot;&quot; END IF TextBox2.Text = expr END FUNCTION PUBLIC SUB Button1_Click() EnLetras(TextBox1.Text) ' TextBox2.Text = &quot;3&quot; END PUBLIC SUB Button2_Click() ME.Close END PUBLIC SUB Button3_Click() TextBox1.Text = &quot;&quot; TextBox2.Text = &quot;&quot; END
  16. 17. Al terminar tendremos una pantalla así:
  17. 18. CALCULAR EL DIGITO VERIFICADOR DE CEDULA ' Gambas module file 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 &quot;INGRESE SU NOMBRE&quot; INPUT NOMBRE PRINT &quot;INGRESE NUMERO DE CEDULA&quot; 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 &quot;EL NUMERO DE SU CEDULA ES....&quot; & Str(L) & &quot;-&quot; & Str(K) END
  18. 19. 'EL ECUADOR EXPORTA CAFE, CACAO Y MAIZ.SE DESEA CALCULAR EL TOTAL DE QUINTALES EXPORTADOS 'Y EL PORCENTAJE DE CADA PRODUCTO EXPORTADO CON LOS SIGUIENTES DATOS: 'MAIZ 300 'CAFE 400 CACAO 800 ' Gambas module file 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 &quot;EL TOTAL ES....&quot; PRINT T PRINT &quot;EL PORCENTAJE DE MAIZ ES....&quot; PRINT PM & &quot;%&quot; PRINT &quot;EL PORCENTAJE DE CAFE ES....&quot; PRINT PC & &quot;%&quot; PRINT &quot;EL PORCENTAJE DE CACAO ES....&quot; PRINT PO & &quot;%&quot; END
  19. 20. SERIE FIBONACCI   PUBLIC SUB Main() DIM p, s, t, x AS Integer DIM fibo AS String p = 0 s = 1 fibo = Str(p) & Str(s) WHILE x < 5 t = p + s fibo = fibo & Str(t) p = s s = t x = x + 1 WEND PRINT fibo END El resultado seria 0112358
  20. 21. LLAMADO FUNCION SUMA RESTA MULTIPLICACION DIVISION PUBLIC SUB Main() DIM a, b, h, z AS Integer PRINT &quot;ingrese primer valor&quot; INPUT a PRINT &quot;ingrese segundo valor&quot; INPUT b pintamedia(a, b) h = 20 z = 30 pintamedia(h, z) END PUBLIC SUB pintamedia(v1 AS Integer, v2 AS Integer) DIM s AS Integer DIM r AS Integer DIM m AS Integer DIM d AS Integer s = v1 + v2 PRINT &quot;la suma es;....&quot;, s r = v1 - v2 PRINT &quot;la resta es;....&quot;, r m = v1 * v2 PRINT &quot;la multiplicacion es;....&quot;, m
  21. 22. d = v1 / v2 PRINT &quot;la division es;....&quot;, d END i ngrese primer valor 5 ingrese segundo valor 2 la suma es;.... 7 la resta es;.... 3 la multiplicacion es;.... 10 la division es;.... 2 la suma es;.... 50 la resta es;.... -10 la multiplicacion es;.... 600 la division es;.... 0   PUBLIC SUB Main() DIM a, b AS Integer PRINT &quot;ingrese primer valor&quot; INPUT a PRINT &quot;ingrese segundo valor&quot; INPUT b PRINT &quot;la suma de los numeros:......&quot;, funciones2.suma(a, b)
  22. 23. PRINT &quot;la resta de los numeros:......&quot;, funciones2.resta(a, b) PRINT &quot;la multiplicacion de los numeros:......&quot;, funciones2.multiplicacion(a, b) PRINT &quot;la division de los numeros:......&quot;, funciones2.division(a, b) END FUNCIONES2 PUBLIC SUB Main() DIM a, b AS Integer PRINT &quot;ingrese primer valor&quot; INPUT a PRINT &quot;ingrese segundo valor&quot; INPUT b PRINT &quot;la suma de los numeros:......&quot;, suma(a, b) PRINT &quot;la resta de los numeros:......&quot;, resta(a, b) PRINT &quot;la multiplicacion de los numeros:......&quot;, multiplicacion(a, b) PRINT &quot;la division de los numeros:......&quot;, division(a, b) END PUBLIC SUB suma(v1 AS Integer, v2 AS Integer) AS Integer DIM s AS Integer s = v1 + v2 RETURN s END  
  23. 24. PUBLIC SUB resta(v1 AS Integer, v2 AS Integer) AS Integer DIM r AS Integer r = v1 - v2 RETURN r END PUBLIC SUB multiplicacion(v1 AS Integer, v2 AS Integer) AS Integer DIM m AS Integer m = v1 * v2 RETURN m END PUBLIC SUB division(v1 AS Integer, v2 AS Integer) AS Integer DIM d AS Integer d = v1 / v2 RETURN d END ingrese primer valor 6 ingrese segundo valor 3 la suma de los numeros:...... 9 la resta de los numeros:...... 3 la multiplicacion de los numeros:...... 18 la division de los numeros:...... 2
  24. 25. FACTURA   PUBLIC i AS Integer PUBLIC r AS Integer PUBLIC m AS Integer 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[4].Width = 80 GridView1[0, 0].Text = &quot;NUM&quot; GridView1[0, 1].TEXT = &quot;DETALLE&quot; GridView1[0, 2].TEXT = &quot;PRECIO.U&quot; GridView1[0, 3].TEXT = &quot;CANT&quot; GridView1[0, 4].TEXT = &quot;TOTAL&quot; r = 0 i = 0 END
  25. 26. PUBLIC SUB Button2_Click() TextBox1.Text = m TextBox2.Text = (m * 7) / 100 TextBox3.Text = ((((TextBox1.Text) - (TextBox2.Text)) * 12) / 100) TextBox4.Text = (TextBox1.Text) - (TextBox2.Text) + (TextBox3.Text) END PUBLIC SUB TextBox5_KeyPress() IF Key.Code = 65293 THEN IF TextBox5.Text = &quot;&quot; THEN Message.Info(&quot;Ingrese Detalle&quot;) TextBox5.SetFocus ELSE TextBox6.SetFocus ENDIF ENDIF END PUBLIC SUB TextBox6_KeyPress() IF Key.Code = 65293 THEN IF TextBox6.Text = &quot;&quot; THEN Message.Info(&quot;Ingrese Valor&quot;) TextBox6.SetFocus ELSE TextBox7.SetFocus ENDIF
  26. 27. ENDIF END PUBLIC SUB TextBox7_KeyPress() IF Key.Code = 65293 THEN IF TextBox7.Text = &quot;&quot; THEN Message.Info(&quot;Ingrese Valor&quot;) TextBox7.SetFocus ELSE i = i + 1 r = r + 1 (TextBox8.Text) = i Gridview1[i, 0].Text = Val(Textbox8.Text) GridView1[r, 1].Text = (Textbox5.Text) GridView1[r, 2].Text = Textbox6.Text GridView1[r, 3].Text = Textbox7.Text TextBox9.Text = (Textbox6.Text) * (Textbox7.Text) GridView1[r, 4].Text = Val(TextBox9.Text) m = m + TextBox9.Text Textbox5.Text = &quot;&quot; Textbox6.Text = &quot;&quot; Textbox7.Text = &quot;&quot; Textbox5.SetFocus ENDIF ENDIF END PUBLIC SUB Button1_Click() Form3.Hide FMain.Show Textbox1.Text = &quot;&quot; Textbox2.Text = &quot;&quot; Textbox3.Text = &quot;&quot; TextBox4.Text = &quot;&quot; Textbox5.Text = &quot;&quot; Textbox6.Text = &quot;&quot; Textbox7.Text = &quot;&quot; Textbox8.Text = &quot;&quot; Textbox9.Text = &quot;&quot; GridView1.Clear END
  27. 29. OBTENER N{UMERO MAYOR MEDIO Y MENOR   PUBLIC SUB Main() DIM a, b, c AS Integer a = 15 b = 100 c = 22 IF a > b AND a > c THEN PRINT &quot;El mayor es...:&quot; & Str(a) IF b > c THEN PRINT &quot;El intermedio es...:&quot; & Str(b) PRINT &quot;El menor es...:&quot; & Str(c) ELSE PRINT &quot;El intermedio es...:&quot; & Str(c) PRINT &quot;El menor es...:&quot; & Str(b) ENDIF ELSE IF b > c THEN PRINT &quot;El mayor es...:&quot; & Str(b) IF a > c THEN PRINT &quot;El intermedio es...:&quot; & Str(a) PRINT &quot;El menor es...:&quot; & Str(c) ELSE
  28. 30. PRINT &quot;El intermedio es...:&quot; & Str(c) PRINT &quot;El menor es...:&quot; & Str(a) ENDIF ELSE PRINT &quot;El mayor es...:&quot; & Str(c) IF a > b THEN PRINT &quot;El intermedio es...:&quot; & Str(a) PRINT &quot;El menor es...:&quot; & Str(b) ELSE PRINT &quot;El intermedio es...:&quot; & Str(b) PRINT &quot;El menor es...:&quot; & Str(a) ENDIF ENDIF ENDIF END RESULTADO El mayor es...:100 El intermedio es...:22 El menor es...:15
  29. 31. NUMERO MAYOR DE TRES NUMEROS DADOS   PRINT &quot;INGRESE PRIMER VALOR&quot; INPUT A PRINT &quot;INGRESE SEGUNDO VALOR&quot; INPUT B PRINT &quot;INGRESE TERCER VALOR&quot; INPUT C IF A > B THEN MAYOR = A ELSE MAYOR = B ENDIF IF C > MAYOR THEN MAYOR = C ENDIF PRINT &quot;EL NUMERO MAYOR ES:...........&quot; & Str(MAYOR) END RESULTADO INGRESE PRIMER VALOR 5 INGRESE SEGUNDO VALOR 9 INGRESE TERCER VALOR 54 EL NUMERO MAYOR ES:...........54
  30. 32. OBJETOS   PRIVATE heroe1 AS NEW superheroe PRIVATE heroe2 AS NEW superheroe PRIVATE heroe3 AS NEW superheroe PUBLIC SUB Main() heroe1.nombre = &quot;Superman&quot; heroe1.actor = &quot;Christopher Reeve&quot; heroe1.habilidad = &quot;volar, es el hombre de acero&quot; heroe1.imprime() heroe2.nombre = &quot;Batman&quot; heroe2.actor = &quot;Bruce Wayne&quot; heroe2.habilidad = &quot;aplicaciones científicas y tecnológicas para crear armas y herramientas con las cuales atrapar a los criminales&quot; heroe2.imprime() heroe3.nombre = &quot;Spiderman&quot; heroe3.actor = &quot;Tobias Vincent Maguire&quot; heroe3.habilidad = &quot;adherirse a las paredes o cualquier material y lanzar telarañas&quot; heroe3.imprime() END PUBLIC nombre AS String PUBLIC actor AS String PUBLIC habilidad AS String ' funcion
  31. 33. PUBLIC FUNCTION imprime() PRINT &quot;hola el nombre de mi actor favorito es:..&quot; & Str(nombre) & &quot; mi personaje es interpretado por:...&quot; & Str(actor) & &quot; su habilidad es:...&quot; & Str(habilidad) END   RESULTADO hola el nombre de mi actor favorito es:..Superman mi personaje es interpretado por:...Christopher Reeve su habilidad es:...volar, es el hombre de acero hola el nombre de mi actor favorito es:..Batman mi personaje es interpretado por:...Bruce Wayne su habilidad es:...aplicaciones científicas y tecnológicas para crear armas y herramientas con las cuales atrapar a los criminales hola el nombre de mi actor favorito es:..Spiderman mi personaje es interpretado por:...Tobias Vincent Maguire su habilidad es:...adherirse a las paredes o cualquier material y lanzar telarañas
  32. 34. OPERRACION SUMA PUBLIC SUB Main() DIM A AS Integer DIM B AS Integer DIM S AS Integer A = 12 B = 32 S = A + B PRINT &quot;LA SUMA ES...&quot; PRINT S END RESULTADO LA SUMA ES... 44
  33. 35. OPERACIONES BÁSICAS PUBLIC SUB Button1_Click() TextBox3.Text = TextBox1.Text + TextBox2.Text END PUBLIC SUB Button2_Click() TextBox1.Text = &quot;&quot; TextBox2.Text = &quot;&quot; TextBox3.Text = &quot;&quot; END PUBLIC SUB Button3_Click() opebasic.CLOSE END PUBLIC SUB Button4_Click() TextBox3.Text = TextBox1.Text - TextBox2.Text END PUBLIC SUB Button5_Click() TextBox3.Text = TextBox1.Text * TextBox2.Text END PUBLIC SUB Button6_Click() TextBox3.Text = TextBox1.Text / TextBox2.Text END PUBLIC SUB Button7_Click() TextBox3.Text = &quot;&quot; END
  34. 36. PROTECTOR DE PANTALLA 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
  35. 37. END PUBLIC SUB Timer2_Timer() DIM c1, c2, c AS Integer C1 = Int(Rnd() * 1000) C2 = Int(Rnd() * 1000) C = Int(Rnd() * 400) Draw.Begin(area1) Draw.FillColor = Color.RGB((160 + c1), (2 + c2), (c1 + C2)) 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) Draw.Begin(area1) Draw.FillColor = Color.RGB((300 + c1), (7 + c2), (c1 + C2)) Draw.FillStyle = Fill.Dense94 Draw.Line(C1, C2, C, c) Draw.End END
  36. 38. PUBLIC SUB Timer4_Timer() DIM c1, c2, c, r AS Integer C1 = Int(Rnd() * 600) C2 = Int(Rnd() * 600) C = Int(Rnd() * 40) Draw.Begin(area1) Draw.FillColor = Color.RGB((200 + c1), (5 + c2), (c1 + C2)) 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 = &quot;&quot; TextBox2.Text = Timer ELSE C1 = Int(Rnd() * 600) C2 = Int(Rnd() * 600) C = Int(Rnd() * 40) Draw.Begin(area1) Draw.FillColor = Color.RGB((200 + c1), (5 + c2), (c1 + C2)) Draw.FillStyle = Fill.Dense94 Draw.End TextBox2.Text = Timer ENDIF END
  37. 40. TABLA DE MULTIPLICAR PUBLIC SUB Main() DIM A, T, N, I AS Integer PRINT &quot;INGRESE TABLA&quot; INPUT T PRINT &quot;INGRESE HASTA QUE NUMERO DESEA QUE SE MULTIPLIQUE LA TABLA&quot; INPUT N   FOR I = 1 TO N A = T * I PRINT Str(T) & &quot;X&quot; & Str(I) & &quot;=&quot; & Str(A) NEXT END RESULTADO INGRESE TABLA 4 INGRESE HASTA QUE NUMERO DESEA QUE SE MULTIPLIQUE LA TABLA 12 4X1=4 4X2=8 4X3=12 4X4=16 4X5=20 4X6=24 4X7=28 4X8=32 4X9=36 4X10=40 4X11=44 4X12=48  
  38. 41. UNION DE CADENAS ' Gambas class file PRIVATE marca AS String PRIVATE modelo AS String PRIVATE tipo AS String PRIVATE calificacion AS String PRIVATE version AS String PUBLIC SUB datomarca(cadena AS String) marca = cadena END PUBLIC SUB datomodelo(cadena AS String) modelo = cadena END PUBLIC SUB datotipo(cadena AS String) tipo = cadena END PUBLIC SUB datocalificacion(cadena AS String) calificacion = cadena END PUBLIC SUB datoversion(cadena AS String) version = cadena END
  39. 42. PUBLIC FUNCTION descripcion() AS String RETURN marca & &quot; &quot; & modelo & &quot; &quot; & tipo & &quot; &quot; & calificacion & &quot; &quot; & version END RESULTADO DESCRIPCION MARCA MODELO TIPO CALIFICACION VERSION AUTO:... ALFA Alfa Romeo Hatchback (5 Puertas) EXCELENTE 147 2.0 Distinctive
  40. 43. JUEGO DE AZAR RANDOMICOS ' Gambas class file PUBLIC SUB _new() END PUBLIC SUB Form_Open() Label1.Text = &quot;INGRESE CANTIDAD APOSTAR&quot; END PUBLIC SUB Button2_Click() ME.Close END PUBLIC SUB Button3_Click() DIM N1, N2, N3 AS Integer DIM A, B, C, D, E, F, G, H, I, J AS Integer DIM Z AS Float RANDOMIZE N1 = Int(Rnd() * 10) TextBox1.Text = N1 RANDOMIZE N2 = Int(Rnd() * 10) TextBox2.Text = N2 RANDOMIZE N3 = Int(Rnd() * 10)
  41. 44. TextBox3.Text = N3 A = 1 B = 2 C = 3 D = 4 E = 5 F = 6 G = 7 H = 8 I = 9 J = 10 IF (TextBox1.Text = TextBox2.Text) AND (TextBox2.Text = TextBox3.Text) IF TextBox1.Text = A AND TextBox2.Text = A AND TextBox3.Text = A THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * A Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = B AND TextBox2.Text = B AND TextBox3.Text = B THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * B Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE
  42. 45. IF TextBox1.Text = C AND TextBox2.Text = C AND TextBox3.Text = C THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * C Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = D AND TextBox2.Text = D AND TextBox3.Text = D THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * D Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = E AND TextBox2.Text = E AND TextBox3.Text = E THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * E Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = F AND TextBox2.Text = F AND TextBox3.Text = F THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * F Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = G AND TextBox2.Text = G AND TextBox3.Text = G THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * G
  43. 46. Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = H AND TextBox2.Text = H AND TextBox3.Text = H THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * H Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = I AND TextBox2.Text = I AND TextBox3.Text = I THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * I Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = J AND TextBox2.Text = J AND TextBox3.Text = J THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * J Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ENDIF ENDIF ENDIF ENDIF ENDIF
  44. 47. ENDIF ENDIF ENDIF ENDIF ENDIF ELSE TextBox5.Text = Val(TextBox5.Text) - Val(TextBox4.Text) Message(&quot;PERDISTE&quot;) TextBox4.Text = &quot;0&quot; ENDIF END PUBLIC SUB Button1_Click() DIM N1, N2, N3 AS Integer DIM A, B, C, D, E, F, G, H, I, J AS Integer DIM Z AS Float RANDOMIZE N1 = Int(Rnd() * 10) TextBox1.Text = N1 RANDOMIZE N2 = Int(Rnd() * 10) TextBox2.Text = N2 RANDOMIZE N3 = Int(Rnd() * 10)
  45. 48. TextBox3.Text = N3 A = 1 B = 2 C = 3 D = 4 E = 5 F = 6 G = 7 H = 8 I = 9 J = 10 ' IF TextBox1.Text = &quot;&quot; ' ELSE IF (TextBox1.Text = TextBox2.Text) AND (TextBox2.Text = TextBox3.Text) IF TextBox1.Text = A AND TextBox2.Text = A AND TextBox3.Text = A THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * A Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = B AND TextBox2.Text = B AND TextBox3.Text = B THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * B Message(&quot;GANASTE&quot;)
  46. 49. TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = C AND TextBox2.Text = C AND TextBox3.Text = C THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * C Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = D AND TextBox2.Text = D AND TextBox3.Text = D THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * D Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = E AND TextBox2.Text = E AND TextBox3.Text = E THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * E Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = F AND TextBox2.Text = F AND TextBox3.Text = F THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * F Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE
  47. 50. IF TextBox1.Text = G AND TextBox2.Text = G AND TextBox3.Text = G THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * G Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = H AND TextBox2.Text = H AND TextBox3.Text = H THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * H Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = I AND TextBox2.Text = I AND TextBox3.Text = I THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * I Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ELSE IF TextBox1.Text = J AND TextBox2.Text = J AND TextBox3.Text = J THEN TextBox5.Text = Val(TextBox5.Text) + Val(TextBox4.Text) * J Message(&quot;GANASTE&quot;) TextBox4.Text = &quot;0&quot; ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF ELSE TextBox5.Text = Val(TextBox5.Text) - Val(TextBox4.Text) Message(&quot;PERDISTE&quot;) TextBox4.Text = &quot;0&quot; ENDIF END
  48. 52. RELOJ DIGITAL ' Gambas class file 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(&quot;Es facil programar en Gambas&quot;) ME.CLOSE END PUBLIC SUB Button2_Click() Message.Delete(&quot;Ejemplo de Reloj Digital &quot;) END PUBLIC SUB Form_Activate() TextLabel1.Text = Time(Hour(Now)) END  
  49. 53. 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 = &quot;INICIAR&quot; THEN Timer1.Enabled = TRUE Button1.Caption = &quot;PARAR&quot; ELSE IF Button1.Text = &quot;PARAR&quot; THEN Timer1.Enabled = FALSE Button1.Caption = &quot;INICIAR&quot; ENDIF ENDIF END PUBLIC SUB Button2_Click() FMain.Show CRONOMETRO1.Hide END

×