program datasiswa;
uses crt;
type
datas = ^data;
data= record
nama, alamat, hp:String;
end;
var
x,i,a,b,y:integer;
biodata:array[1..100] of data;
procedure garis();
begin
writeln('__________________________________________________________________');
end;
procedure input();
begin
for i:=1 to x do
begin
with biodata[i] do
begin
write(i,'. Nama = ');readln(nama);
write( ' Alamat = ');readln(alamat);
write( ' No. Hp = ');readln(hp);
writeln;
end;
end;
end;
procedure output();
begin
garis;
write('No':3); write('Nama':10); write('Alamat':20); writeln('Handphone':22);
garis;
for a:=1 to x do
begin
with biodata[a] do
begin
writeln(a:2,' ':2,nama:10,alamat:20,hp:22);
end;
end;
garis;
end;
procedure hapus(y:integer);
var z:integer;
begin
if (y > x) or (y < 1)then
begin
writeln;
writeln('Data dengan no ',y,' tidak tersedia');
write('Masukkan nomor data yang akan dihapus = ');readln(z);
writeln;
hapus(z);
end
else
begin
for b:=y to x do
begin
if x=1 then
begin
x:=1;
end
else
biodata[y]:=biodata[y+1];
end;
x:=x-1;
writeln('Data Berhasil diHapus');
writeln;
writeln('Data setelah dihapus');
output();
end;
end;
begin
clrscr;
write('Masukkan Jumlah Data = ');readln(x);
input();
output();
write('Masukkan nomor data yang akan dihapus = ');readln(y);
hapus(y);
readln;
end.
Tidak ada komentar:
Posting Komentar