Program Pascal Penginputan Data Mahasiswa Menggunakan Array
Source Code
uses crt;
var
NPM:
array[1..30] of String[8];
Nama:
array[1..30] of String[30];
Jurusan
: array[1..30] of String;
Kelas :
array[1..30] of String;
tanya:
String;
i,j:
Integer;
begin
clrscr;
tanya:='Y';
i:=0;
writeln
('============================================================');
gotoxy(30, 2) ; writeln('Input Data Mahasiswa');
writeln
('============================================================');
write('No');
gotoxy(4, 4) ; write('NPM');
gotoxy(15, 4) ; write('Nama');
gotoxy(35, 4); write('Jurusan');
gotoxy(60, 4); write('Kelas');
gotoxy(75, 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 (NPM[i]);
gotoxy(15,
5+i) ; Readln (Nama[i]);
gotoxy(35,
5+i) ; Readln (Jurusan[i]);
gotoxy(60,
5+i); ; Readln (Kelas[i]);
gotoxy(75,
5+i); ; Readln (tanya);
end;
writeln
('============================================================');
write('Cetak Data Mahasiswa : '); Readln(tanya);
if ((tanya='Y') or (tanya='y')) then
begin
clrscr;
writeln
('============================================================');
gotoxy(30, 2) ; writeln('Data Mahasiswa');
writeln
('============================================================');
write('No');
gotoxy(4, 4) ; write('NPM');
gotoxy(15, 4) ; write('Nama');
gotoxy(35, 4); write('Jurusan');
gotoxy(60, 4); writeln('Kelas');
writeln
('============================================================');
for j:=1
to i do
begin
gotoxy(1, 5+j) ; write(j);
gotoxy(4, 5+j) ; write(NPM[j]);
gotoxy(15, 5+j) ; write(Nama[j]);
gotoxy(35, 5+j); write(Jurusan[j]);
gotoxy(60, 5+j); writeln(Kelas[j]);
end;
writeln
('============================================================');
end;
Readln;
end.
0 Comments