program menu_case;
uses crt;
label awal,akhir;
var
menu,nilai:integer;
nama,prodi:string;
nim:real;
begin
begin
awal:
clrscr;
writeln('program menu oleh:adiyoga');
writeln('Menu');
writeln('1. Biodata Mahasiswa');
writeln('2. Nilai Matkul');
writeln('0. Selesai');
write('Pilih Menu : '); readln(menu);
end;
case menu of
1:begin
clrscr;
writeln('Program Biodata');
writeln;
write('Masukkan Nama : ');readln(nama);
write('Masukkan NIM : ');readln(nim);
write('Masukkan Prodi : ');readln(prodi);
writeln;
writeln('Nama Mahasiswa = ', nama);
writeln('NIM Mahasiswa = ', nim:2:0);
writeln('Prodi Mahasiswa = ', prodi);
readln;
goto awal
end;
2:begin
clrscr;
writeln('Program Nilai Matkul');
writeln;
write('Masukkan Nilai 1-10 : ');readln(nilai);
if(nilai>7) then
begin
writeln('Grade A');
end
else if(nilai<=7) then
begin
writeln('Grade B');
end
else if(nilai<=6) then
begin
writeln('Grade C');
end
else if(nilai<=4) then
begin
writeln('Grade D');
end
else
begin
writeln('Grade E');
end;
readln;
goto awal
end;
0:begin
clrscr;
write('Tekan ENTER..');
readln;
goto akhir;
end;
end;
akhir:
readln;
end.
hasil:
uses crt;
label awal,akhir;
var
menu,nilai:integer;
nama,prodi:string;
nim:real;
begin
begin
awal:
clrscr;
writeln('program menu oleh:adiyoga');
writeln('Menu');
writeln('1. Biodata Mahasiswa');
writeln('2. Nilai Matkul');
writeln('0. Selesai');
write('Pilih Menu : '); readln(menu);
end;
case menu of
1:begin
clrscr;
writeln('Program Biodata');
writeln;
write('Masukkan Nama : ');readln(nama);
write('Masukkan NIM : ');readln(nim);
write('Masukkan Prodi : ');readln(prodi);
writeln;
writeln('Nama Mahasiswa = ', nama);
writeln('NIM Mahasiswa = ', nim:2:0);
writeln('Prodi Mahasiswa = ', prodi);
readln;
goto awal
end;
2:begin
clrscr;
writeln('Program Nilai Matkul');
writeln;
write('Masukkan Nilai 1-10 : ');readln(nilai);
if(nilai>7) then
begin
writeln('Grade A');
end
else if(nilai<=7) then
begin
writeln('Grade B');
end
else if(nilai<=6) then
begin
writeln('Grade C');
end
else if(nilai<=4) then
begin
writeln('Grade D');
end
else
begin
writeln('Grade E');
end;
readln;
goto awal
end;
0:begin
clrscr;
write('Tekan ENTER..');
readln;
goto akhir;
end;
end;
akhir:
readln;
end.
hasil:
Tidak ada komentar:
Posting Komentar