Program Linier_Searching;
uses crt;
const
n = 10;
var
data : array [1..n] of string[1];
nama : string;
item : char;
loc, x, y : integer;
begin
clrscr;
write(' Nama Mahasiswa : ');readln(nama);
for x:=1 to length(nama) do
data[x]:=copy(nama,x,1);
write(' Huruf yang dicari : ');readln(item);
x:=1;
while (data[x] <> ' ') and (x<=n) do inc(x);
data[x] := item;
loc:=1;
while (data[loc])
Tugas 7
Program Binary_Searching;
uses crt;
const
n = 10;
var
data : array[1..n] of string[1];
nm, z : string;
item : char;
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 x:=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;end;
for x:=1 to length(nm) do;
write(' Character di cari : ');readln(item);
x:=1;
while(data[x] <> ' ') and (x<=n) do inc(x);
data[x]:=item;
loc:=1;
while (data[loc] <> item) and (loc<=x) do loc:=loc+1;
write(' Keterangan : ');
if loc = x then
write(' Huruf ',item,' tidak ditemukan')
else
write(' Huruf ',item,' ada di lokasi ',loc);
readln;
end.
uses crt;
const
n = 10;
var
data : array[1..n] of string[1];
nm, z : string;
item : char;
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 x:=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;end;
for x:=1 to length(nm) do;
write(' Character di cari : ');readln(item);
x:=1;
while(data[x] <> ' ') and (x<=n) do inc(x);
data[x]:=item;
loc:=1;
while (data[loc] <> item) and (loc<=x) do loc:=loc+1;
write(' Keterangan : ');
if loc = x then
write(' Huruf ',item,' tidak ditemukan')
else
write(' Huruf ',item,' ada di lokasi ',loc);
readln;
end.
Tugas 8 Karakter Binary
Program Character_Binary;
uses crt;
var
data : array [1..10] of string[1];
nama : string;
z : string;
item : char;
Loc, x, y : integer;
begin
clrscr;
write(' Nama Mahasiswa : ');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(' Character yang dicari : ');readln(item);
writeln(' Keterangan : ');
Loc:=0;
for x:=1 to length(nama) do
begin
loc:=loc+1;
if data[x] = item then
writeln(' ',item,' ada di posisi ke- ', loc)
end;
x:=1;
if loc = x then
writeln (' Character ',item,' tidak ada');
readln;
end.
uses crt;
var
data : array [1..10] of string[1];
nama : string;
z : string;
item : char;
Loc, x, y : integer;
begin
clrscr;
write(' Nama Mahasiswa : ');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(' Character yang dicari : ');readln(item);
writeln(' Keterangan : ');
Loc:=0;
for x:=1 to length(nama) do
begin
loc:=loc+1;
if data[x] = item then
writeln(' ',item,' ada di posisi ke- ', loc)
end;
x:=1;
if loc = x then
writeln (' Character ',item,' tidak ada');
readln;
end.
Tugas 8 Konsonan Binary
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.
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.
Tugas 8 Vocal Binary
Program Vocal_Biner;
uses crt;
var
data : array [1..10] of string[1];
nama : string[10];
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;
for x:=1 to length(nama) do
write(data[x]);writeln;
write('Keterangan : ');
c:=0;
for x:=1 to length(nama) do
begin
if ((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 Vocal tidak ada');
readln;
end.
uses crt;
var
data : array [1..10] of string[1];
nama : string[10];
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;
for x:=1 to length(nama) do
write(data[x]);writeln;
write('Keterangan : ');
c:=0;
for x:=1 to length(nama) do
begin
if ((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 Vocal tidak ada');
readln;
end.
Tugas 8 Spasi Binary
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.
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.
Tugas 8 Karakter Linier
Program Linier_Search;
uses crt;
const
n = 10;
var
data : array [1..n] of string[1];
nama : string[n];
item : char;
Loc, x, y : integer;
begin
clrscr;
write ('Nama Mahasiswa : '); readln(nama);
for x:=1 to length(nama) do
data[x]:=copy(nama,x,1);
write ('Character yang dicari : ');readln(item);
writeln ('Keterangan : ');
Loc:=0;
for x:=1 to length(nama) do
begin
Loc:=Loc+1;
if data[x] = item then
writeln (' ',data[x],' ada diposisi ke- ',Loc);
end;
x:=1;
if Loc = x then
writeln ('Character ',item,' tidak ada');
readln;
end.
uses crt;
const
n = 10;
var
data : array [1..n] of string[1];
nama : string[n];
item : char;
Loc, x, y : integer;
begin
clrscr;
write ('Nama Mahasiswa : '); readln(nama);
for x:=1 to length(nama) do
data[x]:=copy(nama,x,1);
write ('Character yang dicari : ');readln(item);
writeln ('Keterangan : ');
Loc:=0;
for x:=1 to length(nama) do
begin
Loc:=Loc+1;
if data[x] = item then
writeln (' ',data[x],' ada diposisi ke- ',Loc);
end;
x:=1;
if Loc = x then
writeln ('Character ',item,' tidak ada');
readln;
end.
Tugas 8 Konsonan Linier
Program Konsonan_Linier;
uses crt;
var
nama:array[1..10] of string[1];
nm:string;
x,c:byte;
begin
clrscr;
write('Masukkan Nama : ');readln(nm);
for x:=1 to length(nm) do
nama[x]:=copy(nm,x,1);
write('Keterangan : ');
c:=0;
for x:=1 to length(nm) do
begin
if not ((nama[x] = 'a') or (nama[x] = 'A') or
(nama[x] = 'i') or (nama[x] = 'I') or
(nama[x] = 'u') or (nama[x] = 'U') or
(nama[x] = 'e') or (nama[x] = 'E') or
(nama[x] = 'o') or (nama[x] = 'O')) then
begin
c:=c+1;
gotoxy(20,4+C);writeln(nama[x],' ada diposisi ke- ',x);
end;end;
if c=0 then
writeln('Character Konsonan tidak ada');
readln;
end.
uses crt;
var
nama:array[1..10] of string[1];
nm:string;
x,c:byte;
begin
clrscr;
write('Masukkan Nama : ');readln(nm);
for x:=1 to length(nm) do
nama[x]:=copy(nm,x,1);
write('Keterangan : ');
c:=0;
for x:=1 to length(nm) do
begin
if not ((nama[x] = 'a') or (nama[x] = 'A') or
(nama[x] = 'i') or (nama[x] = 'I') or
(nama[x] = 'u') or (nama[x] = 'U') or
(nama[x] = 'e') or (nama[x] = 'E') or
(nama[x] = 'o') or (nama[x] = 'O')) then
begin
c:=c+1;
gotoxy(20,4+C);writeln(nama[x],' ada diposisi ke- ',x);
end;end;
if c=0 then
writeln('Character Konsonan tidak ada');
readln;
end.
Tugas 8 Vocal Linier
Program Vocal_Linier;
uses crt;
var
nama:array[1..10] of string[1];
nm:string;
a,x:byte;
begin
clrscr;
write('Masukkan Nama : ');readln(nm);
for x:=1 to length(nm) do
nama[x]:=copy(nm,x,1);
a:=0;
for x:=1 to length(nm) do
begin
if ((nama[x]='a') or (nama[x]='A') or
(nama[x]='i') or (nama[x]='I') or
(nama[x]='u') or (nama[x]='U') or
(nama[x]='e') or (nama[x]='E') or
(nama[x]='o') or (nama[x]='O') ) then
begin
a:=a+1;
writeln('Keterangan : ',nama[x],' ada di posisi ke- ',x)
end;end;
if a=0 then
writeln('Keterangan : Character vocal tidak ada');
readln;
end.
uses crt;
var
nama:array[1..10] of string[1];
nm:string;
a,x:byte;
begin
clrscr;
write('Masukkan Nama : ');readln(nm);
for x:=1 to length(nm) do
nama[x]:=copy(nm,x,1);
a:=0;
for x:=1 to length(nm) do
begin
if ((nama[x]='a') or (nama[x]='A') or
(nama[x]='i') or (nama[x]='I') or
(nama[x]='u') or (nama[x]='U') or
(nama[x]='e') or (nama[x]='E') or
(nama[x]='o') or (nama[x]='O') ) then
begin
a:=a+1;
writeln('Keterangan : ',nama[x],' ada di posisi ke- ',x)
end;end;
if a=0 then
writeln('Keterangan : Character vocal tidak ada');
readln;
end.
Tugas 8 Spasi Linier
Program Spasi_Linier;
uses crt;
const
n=10;
var
data:array[1..n] of string[1];
nama:string[n]
item:char;
loc,x,y:integer;
begin
clrscr;
write('Nama Mahasiswa : ');readln(nama);
for x:=1 to length(nama) do
data[x]:=copy(nama,x,1);
loc:=1;
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.
uses crt;
const
n=10;
var
data:array[1..n] of string[1];
nama:string[n]
item:char;
loc,x,y:integer;
begin
clrscr;
write('Nama Mahasiswa : ');readln(nama);
for x:=1 to length(nama) do
data[x]:=copy(nama,x,1);
loc:=1;
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.
Tugas 9
Program Binary-Search;
uses crt;
const
n=10;
var
data:array[1..n] of string [1];
nm:string[10];
item:char;
z:string[n];
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;end;
write('Hasil Ascending : ');
for x:=1 to length(nm) do
write(data[x]);
writeln;
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;end;
write('Hasil Desending : ');
for x:=1 to length(nm) do
write(data[x]);writeln;
readln;
end.
uses crt;
const
n=10;
var
data:array[1..n] of string [1];
nm:string[10];
item:char;
z:string[n];
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;end;
write('Hasil Ascending : ');
for x:=1 to length(nm) do
write(data[x]);
writeln;
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;end;
write('Hasil Desending : ');
for x:=1 to length(nm) do
write(data[x]);writeln;
readln;
end.
Langganan:
Postingan (Atom)