}

TEMA

Sabtu, 01 Maret 2014

Program Perulangan

desain program dibawah ini dengan tool: 

 
Objek
Properti
Nilai
Form1
Name
Frmperulangan
Label1
Caption
Program Perulangan
Frame1
Caption
Perintah Perulangan
Command1
Name
Caption
Cmdfor
FOR
Command2
Name
Caption
Cmdfornext
FOR-NEXT
Command3
Name
Caption
Cmdfornested
FOR NESTED
Command4
Name
Caption
Cmddowhile
DO-WHILE
Command5
Name
Caption
Cmddountil
DO-UNTIL
Command6
Name
Caption
Cmddoloop
DO-LOOP
Command7
Name
Caption
Cmdwhilewend
WHILE-WEND
Command8
Name
Caption
Cmdkeluar
&Keluar

Private Sub cmddountil_Click()
frmperulangan.Cls
 kamu = 8
   Do Until kamu = 0
     Frmperulangan.Print kamu;
     kamu = kamu - 2
  Loop
End Sub
Private Sub cmddowhile_Click()
frmperulangan.Cls
kamu = 5
  Do While kamu > 0
     frmperulangan.Print kamu;
     kamu = kamu - 1
  Loop
End Sub
Private Sub cmdfor_Click()
frmperulangan.Cls
  For dcc = 1 To 5
     frmperulangan.Print dcc
    Next dcc
End Sub
Private Sub cmdfornested_Click()
frmperulangan.Cls
Dim a, b As Integer
  For a = 1 To 3
     For b = 10 To 5 Step -1
        frmperulangan.Print b
        Next b
         Next a
End Sub
Private Sub cmdfornext_Click()
frmperulangan.Cls
Dim dcc As Integer
For dcc = 1 To 10
   frmperulangan.Print dcc
   Next dcc
End Sub
Private Sub cmddoloop_Click()
frmperulangan.Cls
y = 6
Do
   frmperulangan.Print y;
   y = y - 1
Loop While y > 0
End Sub
Private Sub cmdkeluar_Click()
  End
End Sub
Private Sub cmdwhilewend_Click()
frmperulangan.Cls
Dim p As Integer
p = 1
While p <= 10
   frmperulangan.Print p
   p = p + 1
WendEnd Sub

dapat juga anda mendownload contoh programnya :

klik disini