Laman

Categories

Selasa, 24 April 2012

Contoh Program Pascal

ini adalah contoh listing program pada Pascal. Semoga bisa bermanfaat.. :)


{PROGRAM LATIHAN LAPORAN}
{Created By Yongki}
uses crt;
var
   NAMA   : Array[1..20] of String[20];
   NPM    : Array[1..20] of String[8];
   FAK    : Array[1..20] of String[2];
   ANGK   : Array[1..20] of String[2];
   BPP    : Array[1..20] of LONGINT;
   I,N    : Byte;
   Total  : LONGINT;

BEGIN
    ClrScr;
    For I := 1 to 3 do
        Begin
        WRITELN('Masukkan data Yang : ',I);
        WRITE('Nama             : ');readln(nama[I]);
        WRITE('NPM              : ');readln(npm[I]);
        FAK[I]  := COPY(NPM[I],1,1);
        ANGK[I] := COPY(NPM[I],4,2);
        IF ANGK[I]='11' THEN BPP[I] := 2000000
           ELSE IF ANGK[I] = '10' THEN BPP[I] := 1750000
                ELSE IF ANGK[I] = '09' THEN BPP[I] := 1600000
                     ELSE BPP[I] := 1500000;
        TOTAL := TOTAL + BPP[I];
        end;
       
    CLRSCR;
        GotoXY(10,2); WRITE('Daftar Mahasiswa');
        GotoXY(10,3); WRITE('--------------------------------------------------------');
        GotoXY(10,4); WRITE('No    NPM','NAMA':8,'FAK':10,'ANGK':11,'BPP':12);
        GotoXY(10,5); WRITE('--------------------------------------------------------');
   
    For N := 1 to I  do
        Begin
        GotoXY(10,5+N); WRITEln(N:1,'   ', NPM[N]:5, NAMA[N]:8, FAK[N]:9, ANGK[N]:11, BPP[N]:12);
        end;
        GotoXY(10,11); WRITEln('--------------------------------------------------------');
        WRITE('TOTAL BPP = ', TOTAL);
        delay(10000);
END.
















0 komentar:

Posting Komentar

^^