Tulis aja dulu, siapa tahu orang lain butuh :-)

PROGRAM RECORD NOMOR URUT MAHASISWA


Program URUT_NIM;
uses wincrt;
const Nmaks = 100;
type 
Mahasiswa = record
NIM  : integer;
Nama : string[20];
Kode : string[10];
Nilai: char;
end;
var
TabMhs : array[1..Nmaks] of Mahasiswa;
Bantuan : Mahasiswa;
I, J, N : integer;
procedure BacaData;
begin
for I := 1 to N do
begin
writeln;
write('Nomor Mahasiwa ke-',I,' ? ');readln(TabMhs[I].NIM);
write('Nama Mahasiwa ke-',I,' ? ');readln(TabMhs[I].Nama);
write('Kode Mata Kuliah ke-',I,' ? ');readln(TabMhs[I].Kode);
write('Nilai Mahasiwa ke-',I,' ? ');readln(TabMhs[I].Nilai);
end;
end;
procedure urut;
begin
for I := 1 to N-1 do
for J := 1 to N-1 do
if TabMhs[J].NIM > TabMhs[J+1].NIM then
begin
Bantuan := TabMhs[J];
TabMhs[J]:= TabMhs[J+1];
TabMhs[J+1]:= Bantuan;
end;
end;
procedure tampil;
begin
writeln;
writeln('------------------------------------------------');
writeln('    Nomor         Nama            Kode    Nilai ');
writeln('------------------------------------------------');
for I := 1 to N do
begin
writeln(TabMhs[I].NIM:7,TabMhs[I].Nama:13,TabMhs[I].Kode:16,TabMhs[I].Nilai:9);
end;
writeln('------------------------------------------------');
end;


(* PROGRAM UTAMA *)
begin
write('Jumlah Mahasiswa ? ');
readln(N);
writeln;
bacadata;


urut;
tampil;
end.
Share:

0 komentar:

Post a Comment

ARCHIEV

VISITORS

free counters

FRIENDS

Blog Archive