SlideShare une entreprise Scribd logo
1  sur  53
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
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 & &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
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
 
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
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;
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
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;
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;
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;
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
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
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
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
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, 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
'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
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
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
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)
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   
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
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
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
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
 
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
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
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
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
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
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
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
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
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
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
 
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  
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
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
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)
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
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
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 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)
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;)
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
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
 
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  
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

Contenu connexe

Tendances

Programas Gambas
Programas GambasProgramas Gambas
Programas Gambasguestdd103d
 
Introduction to CFD FORTRAN code
Introduction to CFD FORTRAN codeIntroduction to CFD FORTRAN code
Introduction to CFD FORTRAN codeBehnam Bozorgmehr
 
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
 
Burger doll order form
Burger doll order formBurger doll order form
Burger doll order formKhairi Aiman
 
키보드 키와 기호 이름 알아보기
키보드 키와 기호 이름 알아보기키보드 키와 기호 이름 알아보기
키보드 키와 기호 이름 알아보기Changwon National University
 
Pasos de proyecto1
Pasos de proyecto1Pasos de proyecto1
Pasos de proyecto1Ayhli123
 
Programming ppt files (final)
Programming ppt files (final)Programming ppt files (final)
Programming ppt files (final)yap_raiza
 
The Ring programming language version 1.7 book - Part 61 of 196
The Ring programming language version 1.7 book - Part 61 of 196The Ring programming language version 1.7 book - Part 61 of 196
The Ring programming language version 1.7 book - Part 61 of 196Mahmoud Samir Fayed
 

Tendances (16)

Gambas
GambasGambas
Gambas
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
Calculadora
CalculadoraCalculadora
Calculadora
 
Introduction to CFD FORTRAN code
Introduction to CFD FORTRAN codeIntroduction to CFD FORTRAN code
Introduction to CFD FORTRAN code
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Ejerciciosdeprogramacion
EjerciciosdeprogramacionEjerciciosdeprogramacion
Ejerciciosdeprogramacion
 
Ejercicios
EjerciciosEjercicios
Ejercicios
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Burger doll order form
Burger doll order formBurger doll order form
Burger doll order form
 
키보드 키와 기호 이름 알아보기
키보드 키와 기호 이름 알아보기키보드 키와 기호 이름 알아보기
키보드 키와 기호 이름 알아보기
 
Pasos de proyecto1
Pasos de proyecto1Pasos de proyecto1
Pasos de proyecto1
 
Protector De Pantalla
Protector De PantallaProtector De Pantalla
Protector De Pantalla
 
Programming ppt files (final)
Programming ppt files (final)Programming ppt files (final)
Programming ppt files (final)
 
The Ring programming language version 1.7 book - Part 61 of 196
The Ring programming language version 1.7 book - Part 61 of 196The Ring programming language version 1.7 book - Part 61 of 196
The Ring programming language version 1.7 book - Part 61 of 196
 
Of class2
Of class2Of class2
Of class2
 

Similaire à Ejemplo En Gambas

Similaire à Ejemplo En Gambas (20)

Calculadora
CalculadoraCalculadora
Calculadora
 
Calculadora
CalculadoraCalculadora
Calculadora
 
Falcon初印象
Falcon初印象Falcon初印象
Falcon初印象
 
Yolygambas
YolygambasYolygambas
Yolygambas
 
Yolygambas
YolygambasYolygambas
Yolygambas
 
Yolygambas
YolygambasYolygambas
Yolygambas
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacks
 
Python quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung FuPython quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung Fu
 
About Go
About GoAbout Go
About Go
 
PL /SQL program UNIT 5 DMS 22319
PL /SQL program UNIT 5 DMS 22319PL /SQL program UNIT 5 DMS 22319
PL /SQL program UNIT 5 DMS 22319
 
Scala 2 + 2 > 4
Scala 2 + 2 > 4Scala 2 + 2 > 4
Scala 2 + 2 > 4
 
Prefix Postfix
Prefix PostfixPrefix Postfix
Prefix Postfix
 
Classical programming interview questions
Classical programming interview questionsClassical programming interview questions
Classical programming interview questions
 
Solucionario_de_Chapra_y_Canale_Quinta_E.pdf
Solucionario_de_Chapra_y_Canale_Quinta_E.pdfSolucionario_de_Chapra_y_Canale_Quinta_E.pdf
Solucionario_de_Chapra_y_Canale_Quinta_E.pdf
 
Proyecto Blob
Proyecto BlobProyecto Blob
Proyecto Blob
 
Top down parsing(sid) (1)
Top down parsing(sid) (1)Top down parsing(sid) (1)
Top down parsing(sid) (1)
 
rules, events and workflow
rules, events and workflowrules, events and workflow
rules, events and workflow
 

Plus de eduann

Firma Digital
Firma DigitalFirma Digital
Firma Digitaleduann
 
Resumen del audio
Resumen del audioResumen del audio
Resumen del audioeduann
 
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
 
Diferecia Entre Hub Y Switch Listo
Diferecia Entre Hub Y Switch ListoDiferecia Entre Hub Y Switch Listo
Diferecia Entre Hub Y Switch Listoeduann
 
Impresoras M T I
Impresoras M T IImpresoras M T I
Impresoras M T Ieduann
 
El Sistema Binario Eduann
El Sistema Binario EduannEl Sistema Binario Eduann
El Sistema Binario Eduanneduann
 
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
 

Plus de eduann (12)

Firma Digital
Firma DigitalFirma Digital
Firma Digital
 
Resumen del audio
Resumen del audioResumen del audio
Resumen del audio
 
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
 
Diferecia Entre Hub Y Switch Listo
Diferecia Entre Hub Y Switch ListoDiferecia Entre Hub Y Switch Listo
Diferecia Entre Hub Y Switch Listo
 
Impresoras M T I
Impresoras M T IImpresoras M T I
Impresoras M T I
 
El Sistema Binario Eduann
El Sistema Binario EduannEl Sistema Binario Eduann
El Sistema Binario Eduann
 
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
 

Dernier

SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
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
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
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
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
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
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
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
 
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
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
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
 
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 khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 

Dernier (20)

SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
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)
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
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
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
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
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
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...
 
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
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
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
 
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 khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 

Ejemplo En Gambas

  • 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. 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. 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. 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. 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
  • 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;
  • 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
  • 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;
  • 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;
  • 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;
  • 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
  • 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
  • 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
  • 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
  • 17. Al terminar tendremos una pantalla así:
  • 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
  • 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
  • 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
  • 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
  • 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)
  • 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  
  • 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
  • 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
  • 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
  • 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
  • 28.  
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 39.  
  • 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  
  • 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
  • 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
  • 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)
  • 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
  • 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
  • 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
  • 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)
  • 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;)
  • 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
  • 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
  • 51.  
  • 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  
  • 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