Kamis, 21 April 2011

Tugas program

USES CRT ;
VAR PIL : BYTE;
PROCEDURE INPUT ;
BEGIN
WRITELN('BAGIAN INPUT');
END;
PROCEDURE OUTPUT;
BEGIN
WRITELN('BAGIAN OUTPUT');
END;
BEGIN
CLRSCR;
PIL :=3;
REPEAT ;
WRITELN('MENU');
WRITELN('1 INPUT DATA');
WRITELN('2 OUTPUT DATA');
WRITELN('KEMENU');
WRITELN('PILIH');
READLN(PIL);
CASE PIL OF
1: INPUT;
2: OUTPUT;
END;
READLN;
UNTIL (PIL =3)
END.

KODE :ARRAY[1..10] OF STRING[3] ;
JUMLAH :ARRAY[1..10] OF BYTE ;
HARGA :LONGINT ;
NAMA :STRING[20] ;
TOTAL :LONGINT ;
I :BYTE ;
BEGIN
FOR I :=1 TO 10 DO
BEGIN
CLRSCR ;
GOTOXY(30,5); WRITE('KODE :');READLN(KODE[I]) ;
GOTOXY(30,6); WRITE('JUMLAH :');READLN(JUMLAH[I]);
END ;
CLRSCR;
GOTOXY(10,3); WRITE('------------------------------------------');
GOTOXY(10,4); WRITE('NO KODE NAMA HARGA JUMLAH TOTAL');
GOTOXY(10,5); WRITE('------------------------------------------');
FOR I :=1 TO 10 DO
BEGIN
IF KODE[I]='001' THEN
BEGIN
NAMA:='TV';HARGA:=1000000 ;
END
ELSE IF KODE[I]='002' THEN
BEGIN
NAMA:='DVD'; HARGA:=550000 ;
END ;
GOTOXY(10,5+I); WRITE(I=2,KODE[I]);
GOTOXY(10,5+I); WRITE(NAMA);
GOTOXY(10,5+I); WRITE(HARGA:9, JUMLAH[I]:3);
TOTAL:=HARGA*JUMLAH[I] ;
GOTOXY(45,5+I); WRITE(TOTAL:8);
END;
GOTOXY(10,6+I); WRITE('---------------------------------------');
READLN ;
END.