Pascal:Coding Array
8:43 PM
met malam kawand, seperti biasanya gw bakal berbagi tentang pascal yang gw pelajari kemarin, yaitu tentang array.
langsung sajalah ini codingnya.
Coding:
uses wincrt;
var
npm: array[1..20] of string[10];
nama,ket: array[1..20] of string[25];
nilai_uts,nilai_uas,n_quis,n_tugas: array[1..20] of real;
rata,had: array[1..20] of real;
byk,i: integer;
n_had : array[1..20] of integer;
begin
clrscr;
write('Isi Beberapa data array yang diperlukan :');readln(byk);
For i := 1 to byk do
begin
clrscr;
write('DATA KE =');writeln(i);
writeln('___________________');
write('NPM =');readln(npm[i]);
write('NAMA =');readln(nama[i]);
write('Nilai UTS =');readln(nilai_uts[i]);
write('Nilai UAS =');readln(nilai_uas[i]);
write('Nilai QUIS =');readln(n_quis[i]);
write('Nilai TUGAS =');readln(n_tugas[i]);
write('JUMLAH HADIR =');readln(n_had[i]);
had[i]:=(n_had[i]*100)/14;
rata[i]:=(nilai_uts[i]+nilai_uas[i]+n_quis[i]+n_tugas[i]+had[i])/5;
if (rata[i]>=60) then
ket[i]:= ('LULUS') else
ket[i]:= ('TIDAK LULUS');
end;
{cetak variabel array}
clrscr;
writeln(' NPM NAMA N_RATA-RATA KET');
writeln(' ======================================================');
For i:= 1 to byk do
begin
writeln(npm[i]:10,'',nama[i]:15,' ',rata[i]:3:2,' ',ket[i]:15);
end;
readln;
end.
Nah, bagaimana dengan hasilnya, memuaskan tidak? hee
sekian dulu za ach, semoga lain kali gw bisa berbagi lagi dengan kalian.
Semoga bermanfaat.
Salam blogger.
0 comments