uses wincrt;
Type tabel_mhs = record
nim :string;
nama :string;
nilai : integer;
end;
Var mhs : array [1..10] of tabel_mhs;
n,i,j,temp1 :integer;
temp2,temp3 :string;
begin
write('>> Jumlah Mahasiswa : ');
readln(n);
for i:=1 to n do
with mhs[i] do
begin
writeln;
writeln('>> Mahasiswa ke- ',i,':');
write('NIM = '); readln(nim);
write('Nama = '); readln(nama);
write('Nilai = '); readln(nilai);
end;
for i:=1 to n-1 do
begin
for j:=i+1 to n do
begin
if mhs[i].nilai>mhs[j].nilai
then
begin
temp1:=mhs[i].nilai;
mhs[i].nilai:=mhs[j].nilai;
mhs[j].nilai:=temp1;
temp2:=mhs[i].nim;
mhs[i].nim:=mhs[j].nim;
mhs[j].nim:=temp2;
temp3:=mhs[i].nama;
mhs[i].nama:=mhs[j].nama;
mhs[j].nama:=temp3;
end;
end;
end;
for i:=1 to n do
begin
Writeln;
writeln('--------------------------------------------');
writeln(' TABEL DATA MAHASISWA UTY ');
writeln('____________________________');
writeln('---------------------------------------------');
writeln(' I NO I NIM I NAMA I NILAI I ');
writeln('---------------------------------------------');
for i:=1 to n do
with mhs[i] do
begin
writeln('I':0,i:2,'I':3,nim:4,'I':4,nama:8,'I':5,nilai:5,'I':4);
writeln('------------------------------------------');
end;
writeln('@ Universitas Teknologi Yogyakarta @');
end;
end.
Type tabel_mhs = record
nim :string;
nama :string;
nilai : integer;
end;
Var mhs : array [1..10] of tabel_mhs;
n,i,j,temp1 :integer;
temp2,temp3 :string;
begin
write('>> Jumlah Mahasiswa : ');
readln(n);
for i:=1 to n do
with mhs[i] do
begin
writeln;
writeln('>> Mahasiswa ke- ',i,':');
write('NIM = '); readln(nim);
write('Nama = '); readln(nama);
write('Nilai = '); readln(nilai);
end;
for i:=1 to n-1 do
begin
for j:=i+1 to n do
begin
if mhs[i].nilai>mhs[j].nilai
then
begin
temp1:=mhs[i].nilai;
mhs[i].nilai:=mhs[j].nilai;
mhs[j].nilai:=temp1;
temp2:=mhs[i].nim;
mhs[i].nim:=mhs[j].nim;
mhs[j].nim:=temp2;
temp3:=mhs[i].nama;
mhs[i].nama:=mhs[j].nama;
mhs[j].nama:=temp3;
end;
end;
end;
for i:=1 to n do
begin
Writeln;
writeln('--------------------------------------------');
writeln(' TABEL DATA MAHASISWA UTY ');
writeln('____________________________');
writeln('---------------------------------------------');
writeln(' I NO I NIM I NAMA I NILAI I ');
writeln('---------------------------------------------');
for i:=1 to n do
with mhs[i] do
begin
writeln('I':0,i:2,'I':3,nim:4,'I':4,nama:8,'I':5,nilai:5,'I':4);
writeln('------------------------------------------');
end;
writeln('@ Universitas Teknologi Yogyakarta @');
end;
end.
Dany Saputra/TI.B/3105111128
Posting Komentar