CLS
TYPE BRG
NAMA AS STRING * 20
KODE AS STRING * 10
JENIS AS STRING * 20
END TYPE
INPUT "MASUKKAN JUMLAH BARANG"; BK
DIM BARANG(BK) AS BRG
FOR i = 1 TO BK STEP 1
PRINT "RECORD KE:"; i
INPUT "KODE:", BARANG(i).KODE
INPUT "NAMA BARANG:",
BARANG(i).NAMA
INPUT "JENIS:", BARANG(i).JENIS
NEXT i
FOR i =
(BK - 1) TO 1 STEP -1
SUKSES = 1
FOR j = 1
TO i
IF
BARANG(j).KODE > BARANG(j + 1).KODE THEN
SWAP
BARANG(j), BARANG(j + 1)
SUKSES = 0
END IF
NEXT j
IF SUKSES
= 1 THEN
i = 0
END IF
NEXT i
CLS
PRINT "DATA BARANG"
PRINT
PRINT
"======================================="
PRINT "KODE NAMA BARANG JENIS"
PRINT
"======================================="
FOR i = 1 TO BK
PRINT BARANG(i).KODE; BARANG(i).NAMA;
BARANG(i).JENIS
NEXT i
PRINT "======================================="
END
Yang diberi warna merukan koding yang melakukan SORT
Dan berikut
gambar saat program dijalankan:
Dan
hasil akhrinya akan seperti:
Dan untuk mendownload program diatas bisa di klik http://www.4shared.com/file/w-qdB-1f/PULUNG.html?