Bu dersimizde Visual Basic'te siyah ekranda(Konsolda) hesap makinesi yapalım...
Bunun için Console Application projesi açalım ve aşağıdaki kodları yazalım...
Bunun için Console Application projesi açalım ve aşağıdaki kodları yazalım...
Kod:
Module Module1
Dim sayi1 As Integer
Dim sayi2 As Integer
Dim secim As Integer
Dim kontrol As String
Dim secimkontrol As String
Sub Main()
kontrol = "E"
While kontrol = "E" Or kontrol = "e"
Console.Title = "Visual Basic Siyah Ekran(Konsol) Hesap Makinesi"
Console.Write("1.Sayıyı Giriniz : ")
sayi1 = Console.ReadLine()
Console.Write("2.Sayıyı Giriniz : ")
sayi2 = Console.ReadLine()
Console.Write("1)Toplama " + vbNewLine + "2)Çıkarma" + vbNewLine + "3)Çarpma" + vbNewLine + "4)Bölme" + vbNewLine + "Seçiminiz : ")
secim = Console.ReadLine()
secimkontrol = "e"
While secimkontrol = "e"
Select Case secim
Case 1
Console.WriteLine(sayi1 & " + " & sayi2 & " = " & (sayi1 + sayi2))
Case 2
Console.WriteLine(sayi1 & " - " & sayi2 & " = " & (sayi1 - sayi2))
Case 3
Console.WriteLine(sayi1 & " * " & sayi2 & " = " & (sayi1 * sayi2))
Case 4
Console.WriteLine(sayi1 & " / " & sayi2 & " = " & (sayi1 / sayi2))
Case Else
Console.Write("Yeniden seçim yapınız..." + vbNewLine + "Seçiminiz : ")
secim = Console.ReadLine()
If secim <= 0 Or secim >= 5 Then
secimkontrol = "e"
Else
secimkontrol = "h"
Select Case secim
Case 1
Console.WriteLine(sayi1 & " + " & sayi2 & " = " & (sayi1 + sayi2))
Case 2
Console.WriteLine(sayi1 & " - " & sayi2 & " = " & (sayi1 - sayi2))
Case 3
Console.WriteLine(sayi1 & " * " & sayi2 & " = " & (sayi1 * sayi2))
Case 4
Console.WriteLine(sayi1 & " / " & sayi2 & " = " & (sayi1 / sayi2))
Case Else
End Select
End If
End Select
End While
Console.WriteLine("Yeni işlem yapmak ister misiniz?EH")
kontrol = Console.ReadLine()
End While
End Sub
End Module
Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)
Benzer konular
- Cevaplar
- 3
- Görüntüleme
- 228
- Cevaplar
- 4
- Görüntüleme
- 253
- Cevaplar
- 3
- Görüntüleme
- 193
- Cevaplar
- 3
- Görüntüleme
- 274