Thursday, July 11, 2013

Visual Basic _ Programming

Untuk murid-murid ICT, sila rujuk aturcara untuk Visual Programming di bawah :

1. (Program to calculate an area of a circle)

Masukan aturcara di bawah
Dim radius As Double
Dim area As Double
Dim answer As String

radius = Val(Jejari.Text)

answer = "The area of a circle is    "

area = 22 / 7 * radius * radius


JAWAB = answer & area


2. (Program To Find A Total And Average Of 3 Numbers)

 Masukan aturcara di bawah
Dim first_number As Double
Dim second_number As Double
Dim third_number As Double
Dim total As Double


first_number = Val(Nombor1.Text)
second_number = Val(Nombor2.Text)
third_number = Val(Nombor3.Text)

total = first_number + second_number + third_number

Jumlah= total

***Setelah selesai, tutup paparan tersebut…

 Klik 2 kali pada kotak Average ,  dan masukkan pula aturcara berikut di dalamnya.

Dim first_number As Double
Dim second_number As Double
Dim third_number As Double
Dim total As Double
Dim average As Double

first_number = Val(Nombor1.Text)
second_number = Val(Nombor2.Text)
third_number = Val(Nombor3.Text)

total = first_number + second_number + third_number
Jumlah = total
average = total / 3

Purata= average

No comments:

Post a Comment