dapat tugas pascal ni kemaren cara buat program pascal hitung kata dan program pascal hitung NG , izinkan saya berbagi..hehehhe
program HitungKata;
uses wincrt;
type
nomor = 1..11;
Larik = array[nomor] of char;
const
Kalimat : Larik = ('B','E','R','R','Y',' ','B','L','O','G','.');
var
x,jumlah : integer;
begin
if Kalimat[1] = '.' then writeln('Ini teks kosong!') else
begin
x := 1;
jumlah := 1;
while Kalimat[x] <> '.' do
begin
write(Kalimat[x]);
if (Kalimat[x] = ' ') and (Kalimat[x-1] <> ' ') then jumlah := jumlah+1;
x := x+1;
end;
end;
writeln;
writeln ('**************************') ;
writeln('Katanya Berjumlah : ',jumlah,' buah');
writeln ('**************************') ;
end.
next...
program hitung_NG;
uses wincrt;
type
nomor = 1..18;
Larik = array[nomor] of char;
const
Kalimat : Larik = ('B','E','R','R','Y',' ','B','L','O','G',' ','M','E','N','A','N','G','#');
var
x,jumlah : integer;
begin
if Kalimat[1] = '#' then writeln('Cuma Teks Kosong...') else
begin
x := 1;
jumlah := 0;
while Kalimat[x] <> '#' do
begin
write(Kalimat[x]);
if (Kalimat[x] = 'N') and (Kalimat[x+1] = 'G') then jumlah := jumlah+1;
x := x+1;
end;
end;
writeln;
writeln ('**********************************************') ;
writeln('Frekuensi pasangan huruf NG berjumlah : ',jumlah,' buah');
writeln ('**********************************************') ;
end.
program HitungKata;
uses wincrt;
type
nomor = 1..11;
Larik = array[nomor] of char;
const
Kalimat : Larik = ('B','E','R','R','Y',' ','B','L','O','G','.');
var
x,jumlah : integer;
begin
if Kalimat[1] = '.' then writeln('Ini teks kosong!') else
begin
x := 1;
jumlah := 1;
while Kalimat[x] <> '.' do
begin
write(Kalimat[x]);
if (Kalimat[x] = ' ') and (Kalimat[x-1] <> ' ') then jumlah := jumlah+1;
x := x+1;
end;
end;
writeln;
writeln ('**************************') ;
writeln('Katanya Berjumlah : ',jumlah,' buah');
writeln ('**************************') ;
end.
next...
program hitung_NG;
uses wincrt;
type
nomor = 1..18;
Larik = array[nomor] of char;
const
Kalimat : Larik = ('B','E','R','R','Y',' ','B','L','O','G',' ','M','E','N','A','N','G','#');
var
x,jumlah : integer;
begin
if Kalimat[1] = '#' then writeln('Cuma Teks Kosong...') else
begin
x := 1;
jumlah := 0;
while Kalimat[x] <> '#' do
begin
write(Kalimat[x]);
if (Kalimat[x] = 'N') and (Kalimat[x+1] = 'G') then jumlah := jumlah+1;
x := x+1;
end;
end;
writeln;
writeln ('**********************************************') ;
writeln('Frekuensi pasangan huruf NG berjumlah : ',jumlah,' buah');
writeln ('**********************************************') ;
end.
4 Responses to "program pascal hitung kata dan program pascal hitung NG"
terima kasih sudah mampir ke blog kami.
salam kenal juga :)
sama2, salam kenal juga :)
Weleh kayanya susah juga ya... :)
info yang bagus sob...
hehehhe,,,
makasih sob..
Posting Komentar