Ejercicios En Gambas

12,364 views

Published on

ejercicios simples en gambas

Published in: Education
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
12,364
On SlideShare
0
From Embeds
0
Number of Embeds
58
Actions
Shares
0
Downloads
229
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Ejercicios En Gambas

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

×