Program Konsonan_Binary;
uses crt;
var
data : array [1..10] of string[1];
nama : string;
z : string;
c, x, y : integer;
begin
clrscr;
write(' Masukkan Nama : ');readln(nama);
for x:=1 to length(nama) do
data [x] :=copy(nama,x,1);
for x:=1 to length(nama)-1 do
begin
for y:=1 to length(nama)-x do
begin
if data[y] > data[y+1] then
begin
z:=data[y];
data[y]:=data[y+1];
data[y+1]:=z;
end;end;end;
write(' Hasil Ascending : ');
for x:=1 to length(nama) do
write(data[x]);writeln;
write(' Keterangan : ');
c:=0;
for x:=1 to length(nama) do
begin
if not ((data[x] = 'a') or (data[x] = 'A') or
(data[x] = 'i') or (data[x] = 'I') or
(data[x] = 'u') or (data[x] = 'U') or
(data[x] = 'e') or (data[x] = 'E') or
(data[x] = 'o') or (data[x] = 'O')) then
begin
c:=c+1;
gotoxy(20,5+c);writeln(' ',data[x],' ada di posisi ke-', x)
end;end;
if c=0 then
writeln('Character Konsonan tidak ada');
readln;
end.
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar