uses crt;
type
mahasiswa = record
nim : integer;
nama : string [15];
mid,ns,na : real;
end;
var
filemahasiswa : file of mahasiswa;
recordmahasiswa : mahasiswa;
lagi : char;
begin
assign(filemahasiswa,'MHS.DAT');
rewrite(filemahasiswa);
lagi :='Y';
while upcase(lagi)='Y' do
begin
clrscr;
with recordmahasiswa do
begin
READ;
gotoxy(5,6); writeln('Nim Mahasiswa :');
gotoxy(5,8); writeln('Nama Mahasiswa :');
gotoxy(5,10);writeln('Nilai Mid :');
gotoxy(5,12);writeln('Nilai Semester :');
gotoxy(5,13);writeln('----------------------');
gotoxy(27,6); readln(nim);
gotoxy(27,8); readln(nama);
gotoxy(27,10); readln(mid);
gotoxy(27,12); readln(ns);
writeln;
na := (mid + ns)/2;
writeln;
gotoxy(5,15); writeln('----------------------');
gotoxy(5,16); writeln('nilai ahir (na)=',na:5:2);
gotoxy(5,17); writeln('----------------------');
end;
write(filemahasiswa, recordmahasiswa);
gotoxy(5,19);write('masukkan data lagi (Y/T) ?'); readln(lagi);
end;
close(filemahasiswa);
end.
type
mahasiswa = record
nim : integer;
nama : string [15];
mid,ns,na : real;
end;
var
filemahasiswa : file of mahasiswa;
recordmahasiswa : mahasiswa;
lagi : char;
begin
assign(filemahasiswa,'MHS.DAT');
rewrite(filemahasiswa);
lagi :='Y';
while upcase(lagi)='Y' do
begin
clrscr;
with recordmahasiswa do
begin
READ;
gotoxy(5,6); writeln('Nim Mahasiswa :');
gotoxy(5,8); writeln('Nama Mahasiswa :');
gotoxy(5,10);writeln('Nilai Mid :');
gotoxy(5,12);writeln('Nilai Semester :');
gotoxy(5,13);writeln('----------------------');
gotoxy(27,6); readln(nim);
gotoxy(27,8); readln(nama);
gotoxy(27,10); readln(mid);
gotoxy(27,12); readln(ns);
writeln;
na := (mid + ns)/2;
writeln;
gotoxy(5,15); writeln('----------------------');
gotoxy(5,16); writeln('nilai ahir (na)=',na:5:2);
gotoxy(5,17); writeln('----------------------');
end;
write(filemahasiswa, recordmahasiswa);
gotoxy(5,19);write('masukkan data lagi (Y/T) ?'); readln(lagi);
end;
close(filemahasiswa);
end.
Tidak ada komentar:
Posting Komentar
Thk's 4 u'r coment.