SlideShare a Scribd company logo
1 of 8
Calculadora en la programación en GAMBAS



PUBLIC CAN AS Integer
PUBLIC OPE1 AS Single
PUBLIC OPE2 AS Single


PUBLIC SUB _new()

END

PUBLIC SUB Form_Open()

END

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

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"

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

  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
  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

 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 Button22_Click()
'Calculo a octal de un número decimal
DIM valor, x1, x2, i AS Integer
DIM cadena, cadena2 AS String
' IF visor.Text <> 0 THEN
   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 Button23_Click()
'Calculo a hexadecimal de un número decimal
DIM valor, x1, x2, i AS Integer
DIM cadena, cadena2 AS String
 valor = TextBox1.Text

 WHILE valor > 0
  x1 = valor MOD 16
  x2 = Int(valor / 16)
  IF x1 = 10 THEN
  cadena = cadena & "A"
  ELSE
  IF x1 = 11 THEN
  cadena = cadena & "B"
  ELSE
  IF x1 = 12 THEN
  cadena = cadena & "C"
  ELSE
  IF x1 = 13 THEN
  cadena = cadena & "D"
  ELSE
  IF x1 = 14 THEN
  cadena = cadena & "E"
  ELSE
  IF x1 = 15 THEN
  cadena = cadena & "F"
  ELSE
  cadena = cadena & Str(x1)
  ENDIF
  ENDIF
  ENDIF
  ENDIF
  ENDIF
  ENDIF
valor = x2
 WEND

 FOR i = Len(cadena) TO 1 STEP -1
   cadena2 = cadena2 & (Mid(cadena, i, 1))
 NEXT
 TextBox1.Text = cadena2

END

PUBLIC SUB Button24_Click()
CAN = 7

  IF TextBox1.Text <> 0 THEN
   OPE1 = TextBox1.Text
   ELSE
   OPE1 = 0
   ENDIF
   TextBox1.Text = OPE1


END

PUBLIC SUB Button25_Click()
CAN = 8

  IF TextBox1.Text <> 0 THEN
   OPE1 = TextBox1.Text
   ELSE
   OPE1 = 0
   ENDIF
   TextBox1.Text = OPE1


END

PUBLIC SUB Button28_Click()

 DIM k AS Float
 k = Rad(TextBox1.Text)
  TextBox1.Text = Sin(k)

END

PUBLIC SUB Button29_Click()

 DIM k AS Float
 k = Rad(TextBox1.Text)
 TextBox1.Text = Cos(k)

END
PUBLIC SUB Button30_Click()

 DIM k AS Float
k = Rad(TextBox1.Text)
 TextBox1.Text = Tan(k)

END

PUBLIC SUB Button26_Click()

 CAN = 9

  IF TextBox1.Text <> 0 THEN
   OPE1 = TextBox1.Text
   ELSE
   OPE1 = 0
   ENDIF
   TextBox1.Text = OPE2

END

PUBLIC SUB Button27_Click()

 CAN = 10

  IF TextBox1.Text <> 0 THEN
   OPE1 = TextBox1.Text
   ELSE
   OPE1 = 0
   ENDIF
   TextBox1.Text = OPE2

END

More Related Content

What's hot

Beginning web programming with PHP [PHP 101-02]
Beginning web programming with PHP [PHP 101-02]Beginning web programming with PHP [PHP 101-02]
Beginning web programming with PHP [PHP 101-02]Mozammel Haque
 
The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88Mahmoud Samir Fayed
 
52 excel rupees converter formulae
52 excel rupees converter formulae52 excel rupees converter formulae
52 excel rupees converter formulaeravikirang42
 
Windows XP Home / Pro Run Commands an...
Windows XP Home / Pro Run Commands an...Windows XP Home / Pro Run Commands an...
Windows XP Home / Pro Run Commands an...Praveen Sudarsan
 

What's hot (7)

Beginning web programming with PHP [PHP 101-02]
Beginning web programming with PHP [PHP 101-02]Beginning web programming with PHP [PHP 101-02]
Beginning web programming with PHP [PHP 101-02]
 
The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184
 
The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88
 
52 excel rupees converter formulae
52 excel rupees converter formulae52 excel rupees converter formulae
52 excel rupees converter formulae
 
Protector De Pantalla
Protector De PantallaProtector De Pantalla
Protector De Pantalla
 
Windows XP Home / Pro Run Commands an...
Windows XP Home / Pro Run Commands an...Windows XP Home / Pro Run Commands an...
Windows XP Home / Pro Run Commands an...
 
Ict project pdf
Ict project pdfIct project pdf
Ict project pdf
 

Viewers also liked

Los balones del mundi al
Los balones del mundi alLos balones del mundi al
Los balones del mundi alsebasyerbas33
 
Social Media for Marketing
Social Media for MarketingSocial Media for Marketing
Social Media for Marketingxjoemanx
 
認識宜蘭縣自然資優方案
認識宜蘭縣自然資優方案認識宜蘭縣自然資優方案
認識宜蘭縣自然資優方案bell5
 
Invito gratuito
Invito gratuitoInvito gratuito
Invito gratuitohormann1
 
417508
417508417508
417508halay
 
Procés tecnologic 2
Procés tecnologic 2Procés tecnologic 2
Procés tecnologic 2oniasame
 
Mule system properties
Mule system propertiesMule system properties
Mule system propertiesKarnam Karthik
 

Viewers also liked (12)

Intro
IntroIntro
Intro
 
Los balones del mundi al
Los balones del mundi alLos balones del mundi al
Los balones del mundi al
 
Iciar Bollaín
Iciar BollaínIciar Bollaín
Iciar Bollaín
 
018 4913 thought conditioners 2014
018 4913 thought conditioners 2014018 4913 thought conditioners 2014
018 4913 thought conditioners 2014
 
Social Media for Marketing
Social Media for MarketingSocial Media for Marketing
Social Media for Marketing
 
Sdsds
SdsdsSdsds
Sdsds
 
認識宜蘭縣自然資優方案
認識宜蘭縣自然資優方案認識宜蘭縣自然資優方案
認識宜蘭縣自然資優方案
 
Invito gratuito
Invito gratuitoInvito gratuito
Invito gratuito
 
417508
417508417508
417508
 
Procés tecnologic 2
Procés tecnologic 2Procés tecnologic 2
Procés tecnologic 2
 
Mule system properties
Mule system propertiesMule system properties
Mule system properties
 
Self employment
Self employmentSelf employment
Self employment
 

Similar to GAMBAS Calculator Program

Similar to GAMBAS Calculator Program (20)

Ejemplo En Gambas
Ejemplo En GambasEjemplo En Gambas
Ejemplo En Gambas
 
Yolygambas
YolygambasYolygambas
Yolygambas
 
Yolygambas
YolygambasYolygambas
Yolygambas
 
Ejercicios
EjerciciosEjercicios
Ejercicios
 
Ejercicios
EjerciciosEjercicios
Ejercicios
 
Ejerciciosdeprogramacion
EjerciciosdeprogramacionEjerciciosdeprogramacion
Ejerciciosdeprogramacion
 
Proyecto Blob
Proyecto BlobProyecto Blob
Proyecto Blob
 
Proyecto 2er Parcial
Proyecto 2er ParcialProyecto 2er Parcial
Proyecto 2er Parcial
 
Yuliana
YulianaYuliana
Yuliana
 
Gambas
GambasGambas
Gambas
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
Manual De Gambas
Manual De GambasManual De Gambas
Manual De Gambas
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
Colegio municipal
Colegio municipalColegio municipal
Colegio municipal
 

Recently uploaded

Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

GAMBAS Calculator Program

  • 1. Calculadora en la programación en GAMBAS PUBLIC CAN AS Integer PUBLIC OPE1 AS Single PUBLIC OPE2 AS Single PUBLIC SUB _new() END PUBLIC SUB Form_Open() END 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 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"
  • 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" 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
  • 3. 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 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
  • 4. 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 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
  • 5. 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 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 Button22_Click()
  • 6. 'Calculo a octal de un número decimal DIM valor, x1, x2, i AS Integer DIM cadena, cadena2 AS String ' IF visor.Text <> 0 THEN 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 Button23_Click() 'Calculo a hexadecimal de un número decimal DIM valor, x1, x2, i AS Integer DIM cadena, cadena2 AS String valor = TextBox1.Text WHILE valor > 0 x1 = valor MOD 16 x2 = Int(valor / 16) IF x1 = 10 THEN cadena = cadena & "A" ELSE IF x1 = 11 THEN cadena = cadena & "B" ELSE IF x1 = 12 THEN cadena = cadena & "C" ELSE IF x1 = 13 THEN cadena = cadena & "D" ELSE IF x1 = 14 THEN cadena = cadena & "E" ELSE IF x1 = 15 THEN cadena = cadena & "F" ELSE cadena = cadena & Str(x1) ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF
  • 7. 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() CAN = 7 IF TextBox1.Text <> 0 THEN OPE1 = TextBox1.Text ELSE OPE1 = 0 ENDIF TextBox1.Text = OPE1 END PUBLIC SUB Button25_Click() CAN = 8 IF TextBox1.Text <> 0 THEN OPE1 = TextBox1.Text ELSE OPE1 = 0 ENDIF TextBox1.Text = OPE1 END PUBLIC SUB Button28_Click() DIM k AS Float k = Rad(TextBox1.Text) TextBox1.Text = Sin(k) END PUBLIC SUB Button29_Click() DIM k AS Float k = Rad(TextBox1.Text) TextBox1.Text = Cos(k) END
  • 8. PUBLIC SUB Button30_Click() DIM k AS Float k = Rad(TextBox1.Text) TextBox1.Text = Tan(k) END PUBLIC SUB Button26_Click() CAN = 9 IF TextBox1.Text <> 0 THEN OPE1 = TextBox1.Text ELSE OPE1 = 0 ENDIF TextBox1.Text = OPE2 END PUBLIC SUB Button27_Click() CAN = 10 IF TextBox1.Text <> 0 THEN OPE1 = TextBox1.Text ELSE OPE1 = 0 ENDIF TextBox1.Text = OPE2 END