lunes, 31 de diciembre de 2012

Lenguaje de Programación


Un lenguaje de programación es un lenguaje artificial que puede ser usado para controlar el comportamiento de una máquina, especialmente una computadora. Estos se componen de un conjunto de reglas sintácticas y semánticas que permiten expresar instrucciones que luego serán interpretadas.
Debe distinguirse de “lenguaje informático”, que es una definición más amplia, puesto estos incluyen otros lenguajes como son el HTML o PDF que dan formato a un texto y no es programación en sí misma.
El programador es el encargado de utilizar un lenguaje de programación para crear un conjunto de instrucciones que, al final, constituirá un programa o subprograma informático.
En su uso, un lenguaje de programación puede acercarse a la forma humana de expresarse y, por eso, este tipo de lenguajes es llamado de alto nivel. Esto significa que utilizan palabras y formas en sus estructuras que se asemejan al lenguaje natural (especialmente al inglés). En cambio, aquellos lenguajes que se aproximan más a la forma en la cual la computadora se maneja, son llamados lenguajes de bajo nivel. Esto significa que lo que el programador deba escribir se acercará al lenguaje máquina, que es, en definitiva, lo que las computadoras pueden interpretar.
De todas maneras, un lenguaje de programación difiere en muchos aspectos de un lenguaje humano. Un código escrito en un lenguaje de programación específico siempre se interpreta de la misma manera (no como los idiomas humanos ambiguos), los errores son mucho más significativos (a tal punto de que un código puede volverse ininterpretable por la computadora), etc.
El código fuente es el conjunto de instrucciones que conforman un programa (o subprograma o módulo). El código fuente debe ser compilado para poder ser interpretado y ejecutado por la computadora. La compilación traduce el código fuente (que depende del lenguaje de programación) a un lenguaje máquina (que depende del sistema de la máquina).
Existen lenguajes del tipo script que son directamente ejecutados por un intérprete y no necesitan compilación.
Los lenguajes de programación pueden clasificarse según el paradigma que usan en: procedimentales, orientados a objetos, funcionales, lógicos, híbridos, etc., clasificación que depende de motivos que escapan al alcance de este artículo.
Son ejemplos de lenguajes de programación: php, prolog, asp, actionscript, ada, python, pascal, c, basic, java, etc.


Concepto Gambas

Gambas es un desarrollo visual de aplicaciones muy similar a los conocidos programas comerciales de Microsoft VisualBasic o BorlandDelphi.

Con Gambas se pueden hacer aplicaciones o programas con interfaz gráfica de forma muy rápida, pues integran un diseñador de formularios o ventanas, un editor de código, un explorador de clases, un visor de ayuda, etc.

Este tipo de herramientas han sido siempre muy habituales en la plataforma Microsoft Windows, pero para Linux no existían tantas, o bien no estaban tan depuradas.

Podemos encontrar Kdevelop, Kylix o VDK Builder. Hay que destacar que en el desarrollo de aplicaciones en Linux hay una larga tradición y costumbre de emplear muchas herramientas diferentes, cada una especializada en una tarea en concreto (por ejemplo, un compilador, un editor, un depurador, cada uno por separado), por lo que este tipo de herramientas integradas no han aparecido hasta hace poco.

Existe un grupo de programadores y desarrolladores que están acostumbrados a estas herramientas integradas, ya sea porque suelen trabajar con ellas en otras plataformas o porque les resulta más cómodo o fácil.

Gambas es una herramienta, que, en palabras de su autor, Benoît Minisini, permite la creación de programas potentes, de forma fácil y sencilla. El lenguaje de programación que se utiliza es una versión del BASIC.

Ejercicio 1

“CALCULAR EL ÁREA DEL CUADRADO”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox2.Text = CInt(TextBox1.Text) * (TextBox1.Text)
Label3.Text = "EL AREA ES:"
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
Label3.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Form1.Hide
END



Ejercicio 2

“CALCULAR EL ÁREA DE UN CÍRCULO”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox3.text = (TextBox1.Text) * (TextBox2.Text) * 3.14
Label4.Text = "EL ÁREA DEL CÍRCULO ES:"
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
Label4.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Form2.Hide
END

Ejercicio 3

“CALCULAR EL ÁREA DE UN TRIÁNGULO”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox3.Text = CInt(TextBox1.text * TextBox2.Text / 2)
Label4.Text = "EL ÁREA DEL TRIÁNGULO ES:"
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
Label4.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Form3.Hide
END

domingo, 30 de diciembre de 2012

Ejercicio 4

“CALCULAR LA SIGUIENTE ECUACIÓN Y=X²-2X+5”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox2.Text = CInt(TextBox1.Text * TextBox1.Text) - CInt(TextBox1.Text * (2)) + CInt(5)
Label3.Text = "EL RESULTADO DE Y ES:"
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
Label3.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Form4.Hide
END

Ejercicio 5


“CALCULAR LA SIGUIENTE ECUACIÓN Y= X³ + 3X²-5X+3”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox2.Text = CInt(TextBox1.Text) * (TextBox1.Text) * (TextBox1.Text) + CInt(TextBox1.Text) * (TextBox1.Text) * (3) - CInt(TextBox1.Text) * (5) + CInt(3)
Label2.Text = "EL VALOR DE Y ES:"
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
Label2.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Form5.Hide
END

Ejercicio 6

“CONVERTIR 125 METROS A CENTÍMETROS”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox1.Text = 125 * 100
END
PUBLIC SUB Button2_Click()
FMain.Show
Form1.Hide
END

Ejercicio 7

“HOLA MUNDO”
' Gambas class file
PUBLIC SUB Button1_Click()
label1.Text = "HOLA MUNDO"
END
PUBLIC SUB Button2_Click()
Label1.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Form2.Hide
END

Ejercicio 8

“CONVERTIR LA EDAD DE UNA PERSONA DE AÑOS A MESES”
' Gambas class file
PUBLIC SUB Button1_Click()
Label4.Text = "SU EDAD ES "
TextBox2.Text = CInt(TextBox1.Text) * 12
Label5.Text = "MESES"
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
Label4.Text = ""
Label5.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Form3.Hide
END

sábado, 29 de diciembre de 2012

Ejercicio 9

“SUMA DE 2 NÚMEROS”
' Gambas class file
PUBLIC SUB Button1_Click()
END
PUBLIC SUB Button2_Click()
Textbox3.Text = TextBox1.Text + textbox2.Text
Message("LA SUMA ES CORRECTA")
END
PUBLIC SUB Button3_Click()
TextBox1.Text = ""
Textbox2.Text = ""
TextBox3.Text = ""
END
PUBLIC SUB Button4_Click()
FMain.Show
Form4.Hide
END

Ejercicio 10

“CALCULADORA BÁSICA”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox3.Text = TextBox1.Text + TextBox2.Text
Label1.Text = "+"
END
PUBLIC SUB Button2_Click()
TextBox3.Text = TextBox1.Text - TextBox2.Text
Label1.Text = "-"
END
PUBLIC SUB Button3_Click()
TextBox3.Text = TextBox1.Text * TextBox2.Text
Label1.Text = "*"
END
PUBLIC SUB Button4_Click()
TextBox3.Text = TextBox1.Text / TextBox2.Text
Label1.Text = "/"
END
PUBLIC SUB Button5_Click()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
Label1.Text = ""
END
PUBLIC SUB Button6_Click()
FMain.Show
Form5.Hide
END
PUBLIC SUB Button7_Click()
END

Ejercicio 11

“A=2B+3-4”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox2.Text = (TextBox1.Text) + (2) + (TextBox1.Text) + (3) - (4)
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Form1.Hide
END

Ejercicio 12


“Y=X+8X+4X-2”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox2.Text = (TextBox1.Text) + (8) + (TextBox1.Text) + (4) + (TextBox1.Text) - (2)
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Form2.Hide
END

Ejercicio 13

“X=2Y+4X+8-7Y”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox2.Text = (2) + (TextBox1.Text) + (4) + (TextBox1.Text) + (8) - (7) - (TextBox1.Text)
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Form3.Hide
END

viernes, 28 de diciembre de 2012

Ejercicio 14

“Z=4Y+2X-2+1”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox2.Text = (TextBox1.Text) + (4) + (TextBox1.Text) + (2) - (2) + (1)
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Form4.Hide
END

Ejercicio 15

“A=2B+5C-4”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox2.Text = (TextBox1.Text) + (2) + (TextBox1.Text) + (5) - (4)
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Form5.Hide
END

Ejercicio 16


“ÁREA DE UN CÍRCULO”
' Gambas class file
PUBLIC SUB Button1_Click()
DIM PII AS Float
PII = 3.14
TextBox2.Text = (PII) * (TextBox1.Text) * (TextBox1.Text)
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Form1.Hide
END

Ejercicio 17

“ÁREA DE UN RECTÁNGULO”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox3.Text = (TextBox1.Text) * (TextBox2.Text) * (TextBox2.Text)
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Form2.Hide
END

Ejercicio 18

“CALCULADORA 2”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox3.Text = TextBox1.Text + TextBox2.Text
END
PUBLIC SUB Button2_Click()
TextBox6.Text = TextBox4.Text - TextBox5.Text
END
PUBLIC SUB Button3_Click()
TextBox9.Text = TextBox7.Text * TextBox8.Text
END
PUBLIC SUB Button4_Click()
TextBox12.Text = TextBox10.Text / TextBox11.Text
END
PUBLIC SUB Button5_Click()
TextBox3.Text = TextBox1.Text + TextBox2.Text
TextBox6.Text = TextBox4.Text - TextBox5.Text
TextBox9.Text = TextBox7.Text * TextBox8.Text
TextBox12.Text = TextBox10.Text / TextBox11.Text
END
PUBLIC SUB Button6_Click()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
TextBox12.Text = ""
END
PUBLIC SUB Button7_Click()
FMain.Show
Form3.Hide
END

jueves, 27 de diciembre de 2012

Ejercicio 19

“RELATOS”
' Gambas class file
PUBLIC SUB TextLabel1_MouseDown()
END
PUBLIC SUB TextLabel1_DblClick()
TextLabel1.Text = InputBox("¿ESCRIBE LO QUE SEA?", "TEXTO", "RELATOS")
END
PUBLIC SUB Form_Open()
ME.Center
ME.Caption = "RELATOS"
END
PUBLIC SUB Button1_Click()
TextLabel1.Text = ""
END
PUBLIC SUB Button2_Click()
FMain.Show
Form4.Hide
END

Ejercicio 20

“PIENSA”
' Gambas class file
PUBLIC SUB Form_Open()
ME.Center
ME.Caption = "PIENSA"
END
PUBLIC SUB TextLabel1_MouseDown()
END
PUBLIC SUB TextLabel1_DblClick()
TextLabel1.Text = InputBox("¿ESCRIBE TUS IDEAS", "TEXTO O NÚMEROS", "PIENSA")
END
PUBLIC SUB Button1_Click()
TextLabel1.Text = ""
END
PUBLIC SUB Button2_Click()
FMain.Show
Form5.Hide
END

Ejercicio 21

“Y=X³-X²+2-3”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox1.Text = InputBox("INGRESE UN DATO", "INGRESO DE VALORES", "")
END
PUBLIC SUB Button2_Click()
TextBox2.Text = ((TextBox1.Text) ^ (3)) - ((TextBox1.Text) ^ (2)) + (2) - (3)
END
PUBLIC SUB Button3_Click()
TextBox1.Text = ""
TextBox2.Text = ""
END
PUBLIC SUB Button4_Click()
FMain.Show
Ecuacion1.Hide
END

Ejercicio 22

“Y=X^(3/2) -7X²+2”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox1.Text = (ComboBox1.Text) ^ 3 - 7 * (ComboBox1.Text * ComboBox1.Text) + 2
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
ComboBox1.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Ecuacion2.Hide
END
PUBLIC SUB ComboBox1_Click()
END

Ejercicio 23

“Y=X^(5/2) -7X⁴+4X³-X²+X-10”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox1.Text = InputBox("INGRESE UN DATO", "INGRESO DE VALORES", "")
END
PUBLIC SUB Button2_Click()
TextBox2.Text = (TextBox1.Text ^ (5 / 2)) - (7 * (TextBox1.Text) ^ (4)) + (4 * (TextBox1.Text) ^ (3)) - (TextBox1.Text ^ 2) + (TextBox1.Text) - 10
END
PUBLIC SUB Button3_Click()
TextBox1.Text = ""
TextBox2.Text = ""
END
PUBLIC SUB Button4_Click()
FMain.Show
Ecuacion3.Hide
END

miércoles, 26 de diciembre de 2012

Ejercicio 24

“Y=(X²-3X-5)^(1/3)”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox1.Text = (ComboBox1.Text) ^ ((2)) - (3) * (ComboBox1.Text) - (5) ^ (1 / 2)
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
ComboBox1.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Ecuacion4.Hide
END


Ejercicio 25

“PASTELERÍA”
' Gambas class file
PUBLIC SUB Button1_Click()
TextBox1.Text = ComboBox1.Text
END
PUBLIC SUB Button2_Click()
TextBox1.Text = ""
ComboBox1.Text = ""
END
PUBLIC SUB Button3_Click()
FMain.Show
Pasteleria1.Hide
END