Senin, 28 November 2011

Update Data File Sequential Menggunakan BASIC

Flowchart  Program Sequential:

Contoh Program Sequential menggunakan BASIC :

10    CLS
20    L$ = "Y": B$ = "T": I = O
30    OPEN "O", #1, "C:MHS.DAT", 28
40    DO WHILE L$ = "y" OR L$ = "Y"
50    I = I + 1: B$ = "T": CLS
60    LOCATE 3, 10: PRINT "MASUKAN DATA"
70    LOCATE 4, 10: PRINT "----------------"
80    LOCATE 6, 5: PRINT "DATA KE:", I
90    WHILE B$ = "T" OR B$ = "t"
100  LOCATE 7, 5: INPUT "NPM:", NPMI$
110  LOCATE 8, 5: INPUT "NAMA:", NMI$
120  LOCATE 9, 5: INPUT "KELAS:", KLS$
130  LOCATE 11, 5: INPUT "DATA SUDAH BENAR[Y/T]?:"; B$
140  WEND
150  WRITE #1, NPM$(I), NM$(I), KLS$(I)
160  LOCATE 13, 5: INPUT "MASIH ADA DATA LAGI[Y/T]:", L$
170  LOOP
180  CLOSE #1
190  FORMAT$ = "|##|########|#########################|#####|"
200  JDL$ = "|NO|   NPM  |          NAMA           |KELAS|"
210  I = 1: GRS$ = STRING$(45, "~"): HAL = 1
220  OPEN "I", #1, "C:MHS.DAT"
230  CLS : NO = 1
240  PRINT TAB(10); "DAFTAR MAHASISWA"
250  PRINT TAB(10); "____________________"; TAB(10); "HALAMAN:"; HAL
260  PRINT GRS$: PRINT JDL$: PRINT GRS$
270  WHILE NOT EOF(1)
280  INPUT #1, NPM$(I), NM$(I), KLS$(I)
290  PRINT USING FORMAT$; NO(I); NPM$(I); NM$(I); KLS$(I): I = I + 1
300  IF NO = 5 THEN PRINT GRS$: STOP: PRINT "TEKAN ENTER UNTUK LANJUT"
310  HAL = HAL + 1: GOTO 230
320  NO = NO + 1
330  WEND
340  PRINT GRS$: CLOSE #1: END
350  END

1 komentar:

  1. maaf,, ko pas di run ada yang eror ya?

    Line:29
    Type mismatch

    itu kira-kira kenapa ya?

    BalasHapus