Program arrprog;
Uses crt;
const
max=20;
add='Add Student File';
edit='Edit Student File';
del='Delete Student File';
vi='View All Student File';
Type
Tdata = record
id:string;
nm:string;
jr:string;
sm:string;
End;
Var
data:array [1..max] of Tdata;
i,ls:integer;
Pil:char;
Procedure menu;
Begin
Writeln('Student Data');
Writeln('----------------');
Writeln;
Writeln('1. ',add);
Writeln('2. ',edit);
Writeln('3. ',del);
Writeln('4. ',vi);
Writeln('5. Exit');
Writeln;
End;
Procedure view(last:integer);
Var
awal:integer;
Begin
Writeln(vi);
Writeln('-------------');
Writeln;
For awal:=1 to last do
Begin
With data[awal] do
Begin
Writeln;
Writeln('Mahasiswa Ke-',awal,' :');
Writeln;
Writeln('Id : ',id);
Writeln;
Writeln('Nama : ',nm);
Writeln;
Writeln('Fakultas : ',jr);
Writeln;
Writeln('Semester : ',sm);
Writeln;
End;
End;
End;
Begin
i:=0;
repeat
clrscr;
menu;
Write('Choice : ');Readln(pil);
Writeln;
Case pil of
'1' : Begin
inc(i);
Writeln(add);
Writeln('----------------');
Writeln;
with data[i] do
Begin
Write('Id : ');Readln(id);
write('Name : ');Readln(nm);
write('Faculty : ');Readln(jr);
write('Semester : ');Readln(sm);
End;
Writeln;
Writeln('Program telah disimpan pada Indeks ke-',i);
delay(2000);
ls:=i;
End;
'2' : Begin
//Confused
End;
'3' : Begin
//Need help for array delete
End;
'4' : Begin
view(ls);
End;
'5' : Begin
writeln('Sedang Menutup program . . . ');
Delay(2000);
exit;
End;
Else
Begin
Writeln('Pilihan tidak sesuai !');
Delay(2000);
End;
End;
until pil='4';
Readln;
End.
Need help for edit and delete code :)