PERTEMUAN KE 12

1 / 14

# PERTEMUAN KE 12 - PowerPoint PPT Presentation

PERTEMUAN KE 12. BAHAN PRAKTIKUM MINGGU Ke 12. SUB PROGRAM & SUB PROCEDURE. Untuk menggabung Fungsi Program dengan Sistem Menu baik Menu Tunggal maupun Menu Berlapis bisa dengan : Sub Program atau Sub Procedure. Sub Program.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### PERTEMUAN KE 12

BAHAN PRAKTIKUM MINGGU Ke12

SUB PROGRAM & SUB PROCEDURE

Sub Program atau

Sub Procedure

Sub Program

UntukSub Program terdiridari Menu Utamadengan File . Exe danFungsi Program dengan File . Tbc

Jumlah File terdiridarisatufile.Exedan n file .Tbc yang jumlahtergantungbanyaknyaFungsi Program.

Sub Procedure

Menu Utama yang berfungsimenjalankanpilihanfungsi program, dansemuafungsi program disimpandalamsatu file.bas

BENTUK UMUMNYA :

SUB NAMA FILE

END SUB NAMA FILE

CALL NAMA FILE

FUNGSI PROGRAM

Fungsi Program terdiridari :

1. Fungsi INPUT

2. Fungsi Edit

3. FungsiTambah

4. FungsiLihat

5. FungsiCetak

6. FungsiLaporan

7. FungsiHapus

Bagan Program Fungsi Input :
• CLS
• DIM ....... DI ISI SESUAI DEGAN FIELD YANG ADA PADA PEKERJAAN
• NOMORFILE1% = 1
• PRINT " NAMA FILE : "; : INPUT, NAMAFILE\$
• PRINT " JUMLAH DATA : "; : INPUT, N
• FOR I = 1 TO N
• PRINT " ......... ";I;" = " ; : INPUT , ....(I)
• GUNAKAN PERINTAH PRINT, INPUT DAN BERSYARAT UNTUK SEMUA FIELD YANG ADA PADA DIM
• NEXT I
• OPEN NAMAFILE\$ FOR OUTPUT AS #NOMORFILE1%
• WRITE #NOMORFILE1%, N
• FOR I = 1 TO N
• WRITE #NOMORFILE1%, I, ........
• NEXT I
• CLOSE #NOMORFILE1%
Bagan Program untukFungsiLaporan
• 50 DIM ...................................
• NOMORFILE1% = 1
• ON ERROR GOTO 100
• PRINT " NAMA FILE = "; : INPUT, NAMAFILE\$
• CLS
• OPEN NAMAFILE\$ FOR INPUT AS #NOMORFILE1%
• INPUT #NOMORFILE1%, N
• FOR I = 1 TO N
• INPUT #NOMORFILE1%, I, .............................
• NEXT I
• LOCATE 1,25 : PRINT " DAFTAR NILAI SISWA "
• LOCATE 3,10 : PRINT STRING\$(50,"~")
• LOCATE 4,10 : PRINT " "
• LOCATE 4,30 : PRINT " "

LOCATE 4,50 : PRINT " "

• LOCATE 5,10 : PRINT STRING\$(50,"~")
• BRS=6
• FOR I = 1 TO N
• LOCATE BRS,10 : PRINT ......(I)
• LOCATE BRS,30 : PRINT .......(I)
• LOCATE BRS,50 : PRINT ........(I)
• BRS=BRS+1
• NEXT I
• LOCATE BRS+2,10: PRINT STRING\$(50,"~")
• CLOSE #NOMORFILE1% :END
• 100 BEEP
• RESUME 50
Bagan Program untukFungsi Edit
• CLS
• 150 DIM .........................
• NOMORFILE1% = 1
• ON ERROR GOTO 100
• PRINT " NAMA FILE : "; : INPUT, NAMAFILE\$
• CLS
• OPEN NAMAFILE\$ FOR INPUT AS #NOMORFILE1%
• INPUT #NOMORFILE1%, N
• FOR I = 1 TO N
• INPUT #NOMORFILE1%, I, ......................
• NEXT I
• PRINT "JUMLAH DATA = " ; N
• 170 FOR I = 1 TO N
• PRINT "DATA YANG DI UBAH DATA KE = " ; : INPUT, I

CLS

• PRINT "DATA SEBELUM DIUBAH : " ;I;" = " ; ........(I)
• PRINT "DATA YANG MAU DIUBAH : "; : INPUT, .......(I)
• 175 PRINT "STOP/LANJUTKAN (S/L) : "; : INPUT SL\$
• IF UCASE\$(SL\$) <> "S" AND UCASE\$(SL\$) <> "L" GOTO 175
• IF UCASE\$(SL\$) = "L" THEN 170
• IF UCASE\$(SL\$) = "S" THEN 190
• 180 NEXT I
• 190 CLOSE #NOMORFILE1%
• OPEN NAMAFILE\$ FOR OUTPUT AS #NOMORFILE1%
• WRITE #NOMORFILE1%, N
• FOR I = 1 TO N
• WRITE #NOMORFILE1%, I, .........
• NEXT I
• CLOSE #NOMORFILE1% : END
• 200 BEEP
• RESUME 150
Bagan Program untukFungsiLihat
• CLS
• 250 DIM .........................
• NOMORFILE1% = 1
• ON ERROR GOTO 100
• PRINT " NAMA FILE : "; : INPUT, NAMAFILE\$
• CLS
• OPEN NAMAFILE\$ FOR INPUT AS #NOMORFILE1%
• INPUT #NOMORFILE1%, N
• FOR I = 1 TO N
• INPUT #NOMORFILE1%, I, ......................
• NEXT I
• PRINT "JUMLAH DATA = " ; N
• 270 FOR I = 1 TO N
• PRINT "DATA YANG INGIN Di LIHAT : " ; : INPUT, I

275 PRINT “LIHAT DATA LAIN : "; : INPUT SL\$

• IF UCASE\$(SL\$) <> "S" AND UCASE\$(SL\$) <> "L" GOTO 275
• IF UCASE\$(SL\$) = "L" THEN 270
• IF UCASE\$(SL\$) = "S" THEN 290
• 280 NEXT I
• 290 CLOSE #NOMORFILE1%
• OPEN NAMAFILE\$ FOR OUTPUT AS #NOMORFILE1%
• WRITE #NOMORFILE1%, N
• FOR I = 1 TO N
• WRITE #NOMORFILE1%, I, .........
• NEXT I
• CLOSE #NOMORFILE1% : END
• 300 BEEP
• RESUME 150
Bagan Program untukFungsiTambah
• CLS
• DIM ..................................
• NOMORFILE1% = 1
• 350 PRINT " NAMA FILE = "; : INPUT, NAMAFILE\$
• CLS
• OPEN NAMAFILE\$ FOR INPUT AS #NOMORFILE1%
• INPUT #NOMORFILE1%, N
• FOR I = 1 TO N
• INPUT #NOMORFILE1%, I, .....................
• NEXT I
• CLOSE #NOMORFILE1%
• PRINT " JUMLAH DATA SEBELUMNYA : ";N
• PRINT " DATA YANG DITAMBAHKAN : "; : INPUT NN
• NNN = N + NN

FOR I = N+1 TO NNN

• PRINT " ...........KE " ;I;" = "; : INPUT, ........(I)
• NEXT I : PRINT
• FOR I = 1 TO NNN
• PRINT " ...... ";I;" = "; .......(I)
• NEXT I
• OPEN NAMAFILE\$ FOR OUTPUT AS #NOMORFILE1%
• WRITE #NOMORFILE1%, NNN
• FOR I = 1 TO NNN
• WRITE #NOMORFILE1%, I, .....................
• NEXT I
• CLOSE #NOMORFILE1% : END