Selasa, 03 November 2009
Procedure Call By Reference
program prosedur_call_by_reference;
{*Procedure Utk Proses Hitung Nilai*}
uses crt;
procedure hitung_nilai(var tgs,aktif,ujian,akhir:real);
begin
akhir:=(tgs*0.3)+(0.3*aktif)+(0.4*ujian);
end;
{*Procedure Utk Hitung Grade*}
procedure hitung_grade(var grade:char;var akhir:real);
begin
if (akhir>=80) and (akhir<=100) then
grade:='A'
else
if (akhir>=69) and (akhir<=79) then
grade:='B'
else
if (akhir>=58) and (akhir<=68) then
grade:='C'
else
grade:='D';
end;
{*Program Utama*}
var
tgs1,aktif1,ujian1,akhir1:real;
nm,mata:string;
lagi,grade1:char;
label yana;
begin
clrscr;
yana:
write('Nama Siswa : ');readln(nm);
write('Mata Pelajaran : ');readln(mata);
write('Nilai Tugas : ');readln(tgs1);
write('Nilai KeAktifan : ');readln(aktif1);
write('Nilai Ujian : ');readln(ujian1);
clrscr;
hitung_nilai(tgs1,aktif1,ujian1,akhir1);
hitung_grade(grade1,akhir1);
writeln(' Lembaga Kursus "ILMU DUNIA" ');
writeln('__________________________________________');
writeln;
writeln('Siswa Yang Ternama : ',nm);
writeln('Mendapat Nilai Akhir sebesar : ',akhir1:2:2);
writeln('Pada Mata Pelajaran : ',mata);
writeln('Dengan Grade Nilai : ',grade1);
writeln;
writeln;
write(' Create By :: YaN@ ');
writeln;
writeln;
write('Hitung Lagi [Y/T] : ' );readln(lagi);
if (lagi='Y') or (lagi='y') then
goto yana;
readln;
end.
Langganan:
Posting Komentar (Atom)
2 komentar:
Afwan ana gak gerti soal begini tlg bantu agar bs
aduh ka yana mang pantes deh jadi server.. hahaha..
Posting Komentar