Program Pascal Penginputan Data Dosen Menggunakan Array
Source Code
uses crt;
var
NIDN: array[1..30] of String[8];
Nama: array[1..30] of String[30];
MK : array[1..30] of String;
No_HP : array[1..30] of String;
tanya: String;
i,j: Integer;
begin
clrscr;
tanya:='Y';
i:=0;
writeln('==================================================================');
gotoxy(35, 2) ; writeln('Input Data Dosen');
writeln('==================================================================');
write('No');
gotoxy(4, 4) ; write('NIDN');
gotoxy(20, 4) ; write('Nama');
gotoxy(40, 4); write('Mata Kuliah');
gotoxy(60, 4); write('No HP');
gotoxy(80, 4); writeln('Lagi');
writeln('==================================================================');
while ((tanya='Y') or (tanya='y')) do
begin
i:=i+1;
gotoxy(1,
5+i) ; write(i);
gotoxy(4,
5+i) ; Readln (NIDN[i]);
gotoxy(20,
5+i) ; Readln (Nama[i]);
gotoxy(40, 5+i)
; Readln (MK[i]);
gotoxy(60,
5+i); ; Readln (No_HP[i]);
gotoxy(80,
5+i); ; Readln (tanya);
end;
writeln('==================================================================');
write('Cetak Data Dosen : '); Readln(tanya);
if ((tanya='Y') or (tanya='y')) then
begin
clrscr;
writeln('==================================================================');
gotoxy(35, 2) ; writeln('Data Dosen');
writeln('==================================================================');
write('No');
gotoxy(4, 4) ; write('NIDN');
gotoxy(20, 4) ; write('Nama');
gotoxy(40, 4); write('Mata Kuliah');
gotoxy(60, 4); writeln('No HP');
writeln('==================================================================');
for j:=1 to i do
begin
gotoxy(1, 5+j) ; write(j);
gotoxy(4, 5+j) ; write(NIDN[j]);
gotoxy(20, 5+j) ; write(Nama[j]);
gotoxy(40, 5+j); write(MK[j]);
gotoxy(60, 5+j); writeln(No_HP[j]);
end;
writeln('==================================================================');
end;
Readln;
end.
0 Comments