İlk gerçek programımızı bu ders sayesinde yazacağız. Daha önce öğrendiklerimizin de genel bir tekrarı olacak bu derste kendi hesap makinesi programımızı yazacağız.
TextWindow.ForegroundColor = "Yellow" 'başlık bölümü
TextWindow.WriteLine ("********** Microsoft Small Basic Hesap Makinası Programı **********")
TextWindow.ForegroundColor = "White"
TextWindow.Write ("Lütfen isminizi yazınız: ")
isim = TextWindow.Read()
a:
TextWindow.WriteLine ("Hoş geldin " +isim + " Yapmak istediğin işlemi seç")
TextWindow.WriteLine ("1- Toplama")
TextWindow.WriteLine ("2- Çıkarma")
TextWindow.WriteLine ("3- Çarpma")
TextWindow.WriteLine ("4- Bölme")
TextWindow.ForegroundColor = "Red"
secim = TextWindow.ReadNumber ()
TextWindow.ForegroundColor = "White"
If secim =1 Then 'toplama iÅŸlemi
TextWindow.Write (" 1. Sayıyı Giriniz : ")
a= TextWindow.ReadNumber ()
TextWindow.Write (" 2. Sayıyı Giriniz : ")
b= TextWindow.ReadNumber ()
toplam = a + b
TextWindow.Write ( isim + " Sayıların toplamı = ")
TextWindow.ForegroundColor = "Red"
TextWindow.WriteLine (toplam)
TextWindow.ForegroundColor = "White"
Goto a
elseif secim =2 Then 'çıkarma
TextWindow.Write (" 1. Sayıyı Giriniz : ")
a= TextWindow.ReadNumber ()
TextWindow.Write (" 2. Sayıyı Giriniz : ")
b= TextWindow.ReadNumber ()
fark = a - b
TextWindow.Write ( isim + " Sayıların farkı = ")
TextWindow.ForegroundColor = "Red"
TextWindow.WriteLine (fark)
TextWindow.ForegroundColor = "White"
Goto a
elseif secim =3 Then 'çarpma
TextWindow.Write (" 1. Sayıyı Giriniz : ")
a= TextWindow.ReadNumber ()
TextWindow.Write (" 2. Sayıyı Giriniz : ")
b= TextWindow.ReadNumber ()
carpim = a * b
TextWindow.Write ( isim + " Sayıların farkı = ")
TextWindow.ForegroundColor = "Red"
TextWindow.WriteLine (carpim)
TextWindow.ForegroundColor = "White"
Goto a
elseif secim =4 Then 'bölme
TextWindow.Write (" 1. Sayıyı Giriniz : ")
a= TextWindow.ReadNumber ()
TextWindow.Write (" 2. Sayıyı Giriniz : ")
b= TextWindow.ReadNumber ()
bolum = a / b
TextWindow.Write ( isim + " Sayıların bölümü = ")
TextWindow.ForegroundColor = "Red"
TextWindow.WriteLine (bolum)
TextWindow.ForegroundColor = "White"
TextWindow.Write (" ve kalan ise = ")
kalan = Math.Remainder ( a,b)
TextWindow.ForegroundColor = "Red"
TextWindow.WriteLine (kalan)
TextWindow.ForegroundColor = "White"
Goto a
else 'diğer sayılar
TextWindow.ForegroundColor = "Red"
TextWindow.WriteLine ("Lütfen geçerli bir sayı giriniz")
TextWindow.ForegroundColor = "White"
Goto a
endif