Jumat, 15 April 2011

QBasic contoh program menu "LENGKAP"

Penjelasan tentang QBasic**
kalau belum punya QBasic bisa download disini:QBasic Download

Contoh Program Menu BIODATA, LUAS SEGITIGA, DERET, EXIT

PROGRAM:










HASIL PROGRAM:
menu:biodata, luas segitiga, deret, exit










1.biodata












2.Luas Segitiga










3.Deret










4.exit










pada pilihan exit maka program akan langsung keluar (Press any key to continue)

codingnya:

CLS
DIM a AS INTEGER
LOCATE 5, 23
PRINT "Menu"
LOCATE 6, 20
PRINT "1.Biodata"
LOCATE 7, 20
PRINT "2.Luas Segitiga"
LOCATE 8,20
PRINT "3.Deret"
LOCATE 9,20
PRINT "4.EXIT"
LOCATE 10, 20
INPUT "Mau Pilih Yang Mana?", a
SELECT CASE a
CASE 1
DIM Nama AS STRING, Kelas AS STRING, NPM AS INTEGER
INPUT "Nama =", Nama
INPUT "Kelas =", Kelas
INPUT "NPM =", NPM
PRINT
COLOR 1
PRINT "Nama ="; Nama
PRINT "Kelas ="; Kelas
PRINT "NPM ="; NPM
CASE 2
DIM alas, tinggi AS SINGLE
INPUT "Alas =", a
INPUT "Tinggi =", t
LET L = a * t / 2
COLOR 9
PRINT "Luas Segitiga = a * t / 2 =";L
CASE 3
DIM u AS INTEGER
PRINT
INPUT "Masukan Nilai u=", u
PRINT
FOR x = 1 TO u
FOR y = 1 TO x
COLOR 5
PRINT y:
NEXT y
PRINT
NEXT x
CASE 4
GOTO 500
END SELECT
500 END

selamat mencoba:)

0 komentar:

Poskan Komentar