dengan Pascal
Berikut Source Code program:
Program Data_Mahasiswa;
Uses crt;
Type Tabel_Mhs = Recor
Nama : String[10];
NIM : String[10];
Nilai : Integer;
Grade : String[10];
End;
Var
Mhs : Array[1..20] of Tabel_Mhs;
Angka: Real;
i, n: Integer;
Begin
clrscr;
write('Masukkan banyak data : ');readln(n);
for i:=1 to n do
begin
write('Nama Mahasiswa : ');readln(Mhs[i].Nama);
write('NIM Mahasiswa : ');readln(Mhs[i].NIM);
write('Nilai : ');readln(Mhs[i].Nilai);
if Mhs[i].Nilai >= 80 then
Mhs[i].Grade:= 'A'
Else if Mhs[i].Nilai >= 70 then
Mhs[i].Grade:= 'B'
Else if Mhs[i].Nilai >= 60 then
Mhs[i].Grade:= 'C'
Else if Mhs[i].Nilai >= 50 then
Mhs[i].Grade:= 'D'
Else if Mhs[i].Nilai < 50 then
Mhs[i].Grade:= 'E';
Writeln('Grade : ',Mhs[i].Grade);readkey;
End;
Begin
Clrscr;
gotoxy(1,2);Writeln('DATA REPORT':45);
gotoxy(1,4);Writeln('[----][-------------][---------------][-----------][-----------]');
gotoxy(1,5);Writeln('[ NO ][ Nama ][ NIM ][ Nilai ][ Grade ]');
gotoxy(1,6);Writeln('[----][-------------][---------------][-----------][-----------]');
For i:= 1 to n do
Begin
with Mhs[i] do
begin
gotoxy(1,6+i);Write('[ ][ ][ ][ ][ ]');
gotoxy(1,7+i);Write(' ---- ------------- --------------- ---------- ----------- ');
gotoxy(4,6+i);Write(i);
gotoxy(11,6+i);Write(Nama);
gotoxy(27,6+i);Write(NIM);
gotoxy(43,6+i);Write(Nilai);
gotoxy(57,6+i);Write(Grade);
End;
Readkey;
End;
End;
End.
Dan berikut adalah output dari program diatas.
1. Setelah semua data yang diinginkan telah diinput
2. Tabel hasil dari inputan diatas