Program Spasi_Biner;
uses crt;
var
data : array [1..10] of string[1];
nm : string[10];
item : char;
z : string;
loc, x, y : integer;
begin
clrscr;
write('Masukkan Nama : ');readln(nm);
for x:=1 to length(nm) do
data[x]:=copy(nm,x,1);
for x:=1 to length(nm)-1 do
begin
for y:=1 to length(nm)-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;
while (data[loc] <> ' ') and (loc<=x) do
loc:=loc+1;
write ('Keterangan : ');
if loc >=x then
write('SPASI tidak ditemukan')
else
write('SPASI ada dilokasi ',Loc);
readln;
end.
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar