Upcoming SlideShare
×

716 views

Published on

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
716
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
24
0
Likes
1
Embeds 0
No embeds

No notes for slide

1. 1. Calculadora en la programación en GAMBAS PUBLIC CAN AS Integer PUBLIC OPE1 AS Single PUBLIC OPE2 AS Single PUBLIC SUB Button17_Click() TextBox1.Clear() END PUBLIC SUB Button18_Click() ME.Close(0) END PUBLIC SUB Button12_Click() TextBox1.Text = TextBox1.Text & "0" END
2. 2. PUBLIC SUB Button13_Click() TextBox1.Text = TextBox1.Text & "." END PUBLIC SUB Button7_Click() TextBox1.Text = TextBox1.Text & "1" END PUBLIC SUB Button8_Click() TextBox1.Text = TextBox1.Text & "2" END PUBLIC SUB Button9_Click() TextBox1.Text = TextBox1.Text & "3" END PUBLIC SUB Button4_Click() TextBox1.Text = TextBox1.Text & "4" END PUBLIC SUB Button5_Click() TextBox1.Text = TextBox1.Text & "5" END PUBLIC SUB Button6_Click() TextBox1.Text = TextBox1.Text & "6" END PUBLIC SUB Button1_Click() TextBox1.Text = TextBox1.Text & "7" END PUBLIC SUB Button2_Click() TextBox1.Text = TextBox1.Text & "8"
3. 3. END PUBLIC SUB Button3_Click() TextBox1.Text = TextBox1.Text & "9" END PUBLIC SUB Button10_Click() CAN = 4 IF TextBox1.Text <> 0 THEN OPE1 = TextBox1.Text ELSE OPE1 = 0 ENDIF TextBox1.Clear END PUBLIC SUB Button15_Click() CAN = 1 IF TextBox1.Text <> 0 THEN OPE1 = TextBox1.Text ELSE OPE1 = 0 ENDIF TextBox1.Clear END PUBLIC SUB Button14_Click() CAN = 2 IF TextBox1.Text <> 0 THEN OPE1 = TextBox1.Text ELSE OPE1 = 0 ENDIF TextBox1.Clear END PUBLIC SUB Button11_Click() CAN = 3
4. 4. IF TextBox1.Text <> 0 THEN OPE1 = TextBox1.Text ELSE OPE1 = 0 ENDIF TextBox1.Clear END PUBLIC SUB Button16_Click() IF TextBox1.Text <> 0 THEN OPE2 = TextBox1.Text ELSE OPE2 = 0 ENDIF TextBox1.Text = operacion(OPE1, OPE2, CAN) END PUBLIC FUNCTION operacion(v1 AS Float, v2 AS Float, opera AS Integer) AS Float DIM re AS Float DIM X, Y, Z, X1, Y1, Z1, X2, Y2, Z2, f, i AS Integer DIM XX, MEA AS String SELECT CASE opera CASE 1 re = v1 + v2 CASE 2 re = v1 - v2 CASE 3 re = v1 * v2 CASE 4 re = v1 / v2 CASE 5 re = (v1 * v2) / 100 CASE 6 re = v1 ^ 2 Z2 = 1 CASE 7 re = v1 ^ 3 Z2 = 1 CASE 8 re = v1 ^ v2 Z2 = 1 CASE 9 re = 1 / v1
5. 5. Z2 = 1 CASE 10 f=1 FOR i = 1 TO v1 f=f*i NEXT re = f Z2 = 1 END SELECT IF Z2 = 1 THEN RETURN re ELSE RETURN Y1 ENDIF END PUBLIC SUB Button19_Click() CAN = 5 IF TextBox1.Text <> 0 THEN OPE1 = TextBox1.Text ELSE OPE1 = 0 ENDIF TextBox1.Clear END PUBLIC SUB Button20_Click() CAN = 6 IF TextBox1.Text <> 0 THEN OPE1 = TextBox1.Text ELSE OPE1 = 0 ENDIF TextBox1.Text = OPE1 END PUBLIC SUB Button21_Click() 'numero binario DIM valor, x1, x2, i AS Integer DIM cadena, cadena2 AS String valor = TextBox1.Text