habel's Blog

program krs mahasiswa

Posted on: 19 Februari 2010

uses wincrt;
type
siswa=record
nim:string[5];
nama:string[15];
krs:array[1..4,1..5] of integer;
end;
type kuliah=array[1..20] of siswa;
var kul:kuliah;
{——————————————————————–}
function huruf(bobot:integer):char;
begin
case bobot of
0:huruf:=’E’;
1:huruf:=’D’;
2:huruf:=’C’;
3:huruf:=’B’;
4:huruf:=’A’;
end;
end;
{——————————————————————–}
procedure khs(n:integer;kul:kuliah);
var jumsks,usaha,i,j:integer;
ipnya:real;
begin
for i:=1 to n do
begin
Writeln(‘Nim : ‘,kul[i].nim);
Writeln(‘Nama : ‘,kul[i].nama);
writeln;
writeln(‘Kode sks nilai’);
jumsks:=0;usaha:=0;
for j:=1 to 2 do
begin
writeln(kul[i].krs[1,j]:3,’ ‘,kul[i].krs[2,j]:3,’
‘,huruf(kul[i].krs[4,j]):5);
jumsks:=jumsks+kul[i].krs[2,j];
usaha:=usaha + kul[i].krs[2,j]*kul[i].krs[4,j];
end;
if jumsks<>0 then
ipnya:=usaha/jumsks;
writeln;
writeln(‘IP = ‘,ipnya:0:2);
readkey;
12
end;

end;
{——————————————————————–}
function bobot(nilai:integer):integer;
begin
if nilai<40 then bobot:=0
else
if (nilai>=40) and (nilai<55) then bobot:=1
else
if (nilai>=55) and (nilai<65) then bobot:=2
else
if (nilai>=65) and (nilai<76) then bobot:=3
else
bobot:=4;
end;
{——————————————————————–}
procedure masukdata(var kul:kuliah;var n:integer);
var i,j:integer;
begin
clrscr;
write(‘Banyak mahasiswa = ‘);readln(n);
for i:=1 to n do
begin
write(‘Nim : ‘);readln(kul[i].nim);
write(‘Nama : ‘);readln(kul[i].nama);
writeln;
for j:=1 to 2 do
begin
write(‘Kode : ‘);readln(kul[i].krs[1,j]);
write(‘Sks : ‘);readln(kul[i].krs[2,j]);
write(‘Nilai : ‘);readln(kul[i].krs[3,j]);
writeln(‘Bobot : ‘,bobot(kul[i].krs[3,j]));
kul[i].krs[4,j]:=bobot(kul[i].krs[3,j]);
writeln(‘huruf : ‘,huruf(bobot(kul[i].krs[3,j])));
writeln;
end;
end;
end;
var n:integer;
begin
masukdata(kul,n);
readkey;
khs(n,kul);
end.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: