Pages

Rabu, 20 April 2011

PROCEDURE

Uses Crt;
Var Pil : Byte;
    kode : string [3];
    jumlah : byte;
    nama : string [20];
    harga : longint;
    total : longint;
    j     : byte;
    i     :byte;
Procedure Input;
Begin
     Writeln('Bagian Input');
     begin
     clrscr;
     gotoxy(30,5); write('Kode:'); readln (kode);
     gotoxy(30,6); write('Jumlah:'); readln (jumlah);
     end;
End;
Procedure Output;
Begin
     Writeln('Bagian Output');
     clrscr;
    gotoxy(10,3); write('____________________________________________________');
    gotoxy(10,4); write('No  Kode   Nama     Harga  Jumlah  Total');

    begin
         if kode ='001' then
            begin
               nama := 'TV'; harga:= 1000000;
            end
         else if kode ='002' then
            begin
                 nama := 'DVD'; harga:= 650000;
            end;


         total := harga*jumlah;
              i:=0  ;
    for i:=1 to i do;
               gotoxy(10,5); write (i:1, kode :7, nama :7, harga:12,jumlah:5, total:10);


    end;

    gotoxy(10,6); write('_________________________________________________________');

End;
Begin
     Clrscr;
     Pil := 1;
     Repeat
           Writeln('Menu');
           Writeln('1. Input Data');
           Writeln('2. Output Data');
           Writeln('3. Exit');
           Write('Pilihan :');
           Readln(Pil);
           Case Pil of
                1 : Input;
                2 : Output;
           End;
           Readln;
     Until (Pil = 3);
End.

Tidak ada komentar:

Posting Komentar