program input nama;
uses crt;
var
ftext : text;
x,y,z : string;
n : array[1..20] of string;
i : integer;
begin
clrscr;
writeln('INPUT NAMA FILE DAN LETAKNYA , CONTOH =>
D:\EDY.txt');readln;
writeln('----------------------------------------------------');readln;
write('nama file : ');readln(x);
write('posisi : ');readln(y);
assign(ftext,x+y);
rewrite(ftext);
writeln('----------------------------------------------------');
write('input nama mata kuliah : ');readln(z);
writeln('----------------------------------------------------');
writeln('Masukkkan nama mahasiswa yang mengambil
mata kuliah ',z,',satu perbaris.');
writeln('Masukkan baris kosong jika ingin
selesai');readln;
i:=0;
repeat
i:=i+1;
write(i,'.
');readln(n[i]);
readln;
until
n[i]='';
begin
writeln(ftext,'-------------------------------------------------------------');
writeln(ftext,'MATA KULIAH : ',z);
writeln(ftext,'-------------------------------------------------------------');
writeln(ftext,'Nama-nama Mahasiswa yang
mengambil mata kuliah ini : ');
i:=0;
repeat
i:=i+1;
if
n[i]<> '' then
writeln(ftext,i,'.',n[i]);
until
n[i]='';
writeln(ftext,'=============================================================');
writeln('Nama-nama mahasiswa telah tersimpan
di dalam file ',x,'',y,'');readln;
close(ftext);
readln;
end;end.
0 komentar:
Posting Komentar