program CariKode;
uses wincrt;
type AString= array[1..4] of string;
AInteger = array[1..4] of integer;
AChar = array[1..4] of char;
DataBarang = record
Kode : AString;
Nama : AString;
Jumlah : AInteger;
Kondisi : AChar;
end;
var
Datamasuk : DataBarang;
KodeCari,Kondisi : String;
i,j,n : integer;
begin
write('Masukan banyak data : ');readln(n);
clrscr;
for i := 1 to n do
begin
writeln('Datamasuk ',i);
writeln;writeln;
write('Kode barang : ');readln(Datamasuk.Kode[i]);
write('Nama barang : ');readln(Datamasuk.Nama[i]);
write('Jumlah barang : ');readln(Datamasuk.Jumlah[i]);
write('Kondisi(B/R) : ');readln(Datamasuk.Kondisi[i]);
clrscr;
end;
writeln('Tabel Data Barang');
writeln;writeln;
writeln('============================================');
writeln('Kode_Barang Nama_Barang Jumlah Kondisi');
writeln('============================================');
for j := 1 to i do
begin
gotoxy(3,j+6);write(Datamasuk.kode[j]);
gotoxy(16,j+6);write(Datamasuk.Nama[j]);
gotoxy(30,j+6);write(Datamasuk.Jumlah[j]);
gotoxy(40,j+6);
if(Datamasuk.Kondisi[j]= 'B') then writeln('baik')else writeln('rusak');
end;
write('Kode data yang ingin dicari : ');readln(KodeCari);
clrscr;
writeln;
writeln('============================================');
writeln('Kode_Barang Nama_Barang Jumlah Kondisi');
writeln('============================================');
for j := 1 to i do
begin
if Datamasuk.Kondisi[j] = 'B' then Kondisi := 'Baik' else Kondisi := 'Rusak';
if Datamasuk.Kode[j] = KodeCari then
begin
writeln(Datamasuk.Kode[j]:9,Datamasuk.Nama[j]:14,Datamasuk.Jumlah[j]:9,Kondisi:9);
end;
end;
end.
ini hasil penampakan programnya :
0 komentar:
Post a Comment