Gambas: Beispielprogramme3

Aus Wikibooks


Zurück zum Gambas-Inhaltsverzeichnis.


Dies Programm ist ein einfacher Potenzrechner. Es nutzt das mathematische Zeichen ^ für die Hochrechnung. Beispiel: 23= 2*2*2 = 8

2^3 = 8 


' Gambas class file
PUBLIC SUB Button1_Click()
 DIM Pota1 AS Integer
 DIM Pota2 AS Integer
 DIM Pota3 AS Integer

 IF textbox2.Text = 0 THEN
   label1.Text = 1
 ELSE
   Pota1 = Textbox1.Text
   Pota2 = Textbox2.Text
   Pota3 = Pota1^Pota2
   label1.Text = Pota3
 END IF
END
PUBLIC SUB Button2_Click()
 Textbox1.Text =""
 Textbox2.Text ="" 
 label1.Text =""
END
PUBLIC SUB Button3_Click()
 ME.Close 
END