Pascal is one of the leading programs written for the flow structure such as algorithms, at this time we will learn the difference between the case and if the pascal 1.5 (TPW 1.5). note the information before it the following structure basically.
Program namaprogram;? program title
Var type: variable;? type variable
Begin;? launch program
Clrscr? clean the screen (and not be used)
Content? program content
End. ? end of the program
Description
Write? show any posts
Writeln? show any posts in the new
Read? enter data
Readln? enter data on the new line
Var? variable
CASE
program case1;
uses wincrt;
var nip,nama : string;
pendapatan,pajak : real;
gol : char;
begin
clrscr;
writeln(’——— DAFTAR PAJAK ———-’);
writeln(’_________________________________’);
write (’NIP : ‘);readln(nip);
write (’Nama Karyawan : ‘);readln(nama);
write (’Golongan [A,B,C] : ‘);readln(gol);
write (’Pendapatan : ‘);readln(pendapatan);
case upcase(gol) of
‘A’ : begin
writeln(’Golongan ini bebas pajak’);
pajak := 0;
end;
‘B’ : pajak := 0.1 * pendapatan;
‘C’ : pajak := 0.2 * pendapatan;
else write(’Salah melakukan Penginputan data ‘);
end;
writeln(’Pajak : Rp. ‘,pajak:9:2);
end.
In the case shown when running
While the program for the IF
program if1;
uses wincrt;
var nip,nama : string;
pendapatan,pajak : real;
gol : char;
begin
clrscr;
writeln(’——— DAFTAR PAJAK ———-’);
writeln(’_________________________________’);
write (’NIP : ‘);readln(nip);
write (’Nama Karyawan : ‘);readln(nama);
write (’Golongan [A,B,C] : ‘);readln(gol);
write (’Pendapatan : ‘);readln(pendapatan);
if (gol = ‘A’ )or (gol = ‘a’) then
pajak := 0
else if (gol = ‘B’) or (gol = ‘b’) then
pajak := 0.1 * pendapatan
else if (gol = ‘C’) or (gol = ‘c’) then
pajak := 0.2 * pendapatan
else write(’Salah melakukan Penginputan data ‘);
writeln(’Pajak : Rp. ‘,pajak:9:2);
end.
Hopefully with this we can continue to increase our insight and our stock. Study-study and learn, "If we can be helpful for other people and we are very beneficial for us"
Download Full paper: arief-pascal_ifcase2.doc
Sumber: Ilmu komputer
Michael Saylor Siap “Meracuni” Microsoft dengan Bitcoin?
-
(adsbygoogle = window.adsbygoogle || []).push({}); Dunia kripto kembali
dihebohkan dengan kabar terbaru dari Michael Saylor, CEO MicroStrategy yang
dikena...
5 days ago
0 komentar:
Post a Comment