linkedin facebook linkedin facebook nod32

Delphida matnlar bilan ishlash algoritmlarga doir misollar

Muallif: Mengliyev Shoydullo

Qo`shilgan sana: 2014-10-27

Delphida matnlar bilan ishlash algoritmlarga doir misollar

5.1-masala. N ta so’zdan tashkil topgan matnda berilgan so’z nech marta uchrashi aniqlansin.

procedure TForm1.Button1Click(Sender: TObject);
var s:string; a:string[12];
b,m,n,i:integer;
begin
s:=edit1.Text;
a:=edit2.Text;
m:=length(s); n:=length(a); b:=0;
for i:= 1 to m-n+1 do
if copy(s,i,n)=a then b:=b+1;
if b=0 then label3.Caption:='Matnda izlanayotgan so`z yo`q' else
label3.Caption:='Matnda qidirilayotgan so`z '+inttostr(b)+' ta';
end;

end.

5.2-masala. Berilgan matndagi “G” va “I” harflar hamda bo’sh joylar soni aniqlansin.

procedure TForm1.Button1Click(Sender: TObject);
var s:string[50]; b:shortstring;
a,n,m,t,i:integer;
begin
s:=edit1.Text;
a:=length(s);n:=0; m:=0; t:=0;
for i:=1 to a do begin
b:=copy(s,i,1);
if b='I' then n:=n+1;
if b='G' then m:=m+1;
if b=' ' then t:=t+1;end;
label2.Caption:='matnda `I` '+inttostr(n)+' ta';
label3.Caption:='matnda `G` '+inttostr(m)+' ta';
label4.Caption:='matnda ` ` '+inttostr(t)+' ta';

end; end.

5.3-masala. Berilgan matndagi belgilar soni ikkilantirilsin.

procedure TForm1.Button1Click(Sender: TObject);
var s,s1:string[100]; b:shortstring;
a,j,i:integer;
begin
s:=edit1.Text;
a:=length(s);
for i:=1 to a do begin
b:=copy(s,i,1);
for j:=1 to 2 do s1:=concat(s1,b); end;
edit2.Text:=s1;

end; end.

5.4-masala. Berilgan so’z ikkiyoqlama bo’lishini aniqlang.

procedure TForm1.Button1Click(Sender: TObject);
label 1,2;
var s:string[20];
a,i,t:integer;
begin
s:=edit1.Text;
a:=length(s); t:=0;
for i:=1 to a div 2 do
if copy(s,i,1)=copy(s,a+1-i,1) then t:=t+1
else goto 1;
if t=a div 2 then begin
label2.Caption:='so`z ikkiyoqlama';goto 2;end;
1:label2.Caption:='so`z ikkiyoqlama emas';
2:end;

end.

5.5-masala. Berilgan matndagi hamma “I” harflar olib tashlansin.

procedure TForm1.Button1Click(Sender: TObject);
var s:string[30]; i,n:byte;
begin
s:=edit1.Text;
n:=length(s);
for i:=1 to n do
if copy(s,i,1)='I' then delete(s,i,1);
edit2.Text:=s;
end;

end.

5.6-masala. Berilgan matnni teskarisiga yozing.

procedure TForm1.Button1Click(Sender: TObject);
var s,s1:string[30]; a:shortstring;
i,n:byte;
begin
s:=edit1.Text;
n:=length(s); s1:='';
for i:=1 to n do begin
a:=copy(s,n-i+1,1); s1:=concat(s1,a);end;
edit2.Text:=s1;

end; end.

5.7-masala. Berilgan matndagi “P” harflarni “J” harflarga almashtiring.

procedure TForm1.Button1Click(Sender: TObject);
var s:string[30]; i,n:byte;
begin
s:=edit1.Text;
n:=length(s);
for i:=1 to n do
if copy(s,i,1)='P' then begin
delete(s,i,1); insert('J',s,i); end;
edit2.Text:=s;
end; end.

5.8-masala. Beysik tilidagi berilgan operatorlarning inglizcha-o’zbekcha lug’atini tuzing.

Bunda inglizcha so’z kiritilganda uning tarjimasi natija sifatida olinishi kerak.

procedure TForm1.Button1Click(Sender: TObject);
var s:string[10];
begin
s:=edit1.text;
Label2.Caption:='noma`lum so`z';
if s='REM' then label2.Caption:='Izoh';
if s='IF' then Label2.Caption:='Agar';
if s='FOR' then Label2.Caption:='Uchun';
if s='INPUT' then Label2.Caption:='Kiritish';
if s='STOP' then Label2.Caption:='To`xta';
if s='PRINT' then Label2.Caption:='Chop etish';
if s='RUN' then Label2.Caption:='Bajar';

end;end.

5.9-masala. Berilgan matnda faqat bir marta uchraydigan belgilarni (matnda qanday uchrasa, shu tartibda) ajrating.

procedure TForm1.Button1Click(Sender: TObject);
var i,j,n,t:integer;s,s1:string;
begin
s:=edit1.Text;
n:=length(s); t:=0;
for i:=1 to n do begin t:=0;
for j:=1 to n do
if copy(s,i,1)=copy(s,j,1) then t:=t+1;
if t=1 then s1:=concat(s1,copy(s,i,1));end;
edit2.Text:=s1;

end;end.

5.10-masala. Berilgan matnning chap tomonidan N ta belgilarni ajrating.

procedure TForm1.Button1Click(Sender: TObject);
var a:integer;s:string;
begin
s:=edit1.text;
a:=strtoint(edit2.Text);
s:=copy(s,1,a);
edit3.Text:=s;

end;end.

5.11-masala. Berilgan matnning o’ng tomonidan N ta belgilarni ajrating.

procedure TForm1.Button1Click(Sender: TObject);
var a:integer;s:string;
begin
s:=edit1.text;
a:=strtoint(edit2.Text);
delete(s,1,a);
edit3.Text:=s;
end;

end.

5.12-masala. Berilgan matnning orasidan K-simvoldan N-simvolgacha bo’lgan belgilarni ajrating.

procedure TForm1.Button1Click(Sender: TObject);
var k,n:byte; s:string;
begin
s:=edit1.text;
k:=strtoint(Edit2.Text);
n:=strtoint(Edit3.Text);
s:=copy(s,k,n-k);
Edit4.Text:=s;
end;

end.

5.13-masala. Berilgan so’zlarni alfavit bo’yicha tartiblash dasturini tuzing.

var
Form1: TForm1;
a:array[1..10] of string[20];
i:integer; b:string[20];
implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
i:=0;
combobox1.Clear;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
combobox1.Items.Add(combobox1.Text);
i:=i+1;
a[i]:=combobox1.text;
combobox1.SetFocus;
end;

procedure TForm1.Button2Click(Sender: TObject);
label 2;
begin
2:for i:=1 to 9 do
if copy(a[i],1,1)>copy(a[i+1],1,1) then begin
b:=a[i];a[i]:=a[i+1];a[i+1]:=b;end;
for i:=1 to 9 do
if copy(a[i],1,1)>copy(a[i+1],1,1) then goto 2;
memo1.Clear;
for i:=1 to 10 do
memo1.Lines.Add(a[i]);

end; end.

5.14-masala. Berilgan N ta so’zlardan eng uzunini aniqlang.

var
Form1: TForm1;
a:array[1..10] of string[20];
n,i,maxx,t:integer;
implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
i:=0;
combobox1.Clear;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
combobox1.Items.Add(combobox1.Text);
i:=i+1;
a[i]:=combobox1.text;
combobox1.SetFocus;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
maxx:=length(a[1]);
for i:=2 to 10 do
if maxx<length(a[i]) then begin
maxx:=length(a[i]);t:=i;end;
edit1.text:=a[t];
end; end.

5.15-masala. Berilgan natural sonning xona birliklarini ajratib yozing.

procedure TForm1.Button1Click(Sender: TObject);
var s:string; n,i:integer;
begin
s:=Edit1.Text;
n:=length(s);
for i:=1 to n div 3 do
insert(' ',s,n-3*i+1);
edit2.Text:=s;
end;end.

5.16-masala. Mingdan kichik bo’lgan berilgan natural sonni qanday o’qilishini bosib chiqaring.

procedure TForm1.Button1Click(Sender: TObject);
var s,t:string[50];n:byte;
begin
s:=edit1.Text;
n:=length(s);label3.Caption:=' ';
if n=3 then begin
Label2.Caption:='Bu uch xonali son va u quyidagicha o`qiladi';
if copy(s,n-2,1)='1' then t:='bir yuz';
if copy(s,n-2,1)='2' then t:='ikki yuz';
if copy(s,n-2,1)='3' then t:='uch yuz';
if copy(s,n-2,1)='4' then t:='to`rt yuz';
if copy(s,n-2,1)='5' then t:='besh yuz';
if copy(s,n-2,1)='6' then t:='olti yuz';
if copy(s,n-2,1)='7' then t:='yetti yuz';
if copy(s,n-2,1)='8' then t:='sakkiz yuz';
if copy(s,n-2,1)='9' then t:='to`qqiz yuz';
label3.Caption:=label3.Caption+' '+t;
if copy(s,n-1,1)='1' then t:='o`n';
if copy(s,n-1,1)='2' then t:='yigirma';
if copy(s,n-1,1)='3' then t:='o`ttiz';
if copy(s,n-1,1)='4' then t:='qirq';
if copy(s,n-1,1)='5' then t:='ellik';
if copy(s,n-1,1)='6' then t:='oltmish';
if copy(s,n-1,1)='7' then t:='yetmish';
if copy(s,n-1,1)='8' then t:='sakson';
if copy(s,n-1,1)='9' then t:='to`qson';
label3.Caption:=label3.Caption+' '+t;
if copy(s,n,1)='1' then t:='bir';
if copy(s,n,1)='2' then t:='ikki';
if copy(s,n,1)='3' then t:='uch';
if copy(s,n,1)='4' then t:='to`rt';
if copy(s,n,1)='5' then t:='besh';
if copy(s,n,1)='6' then t:='olti';
if copy(s,n,1)='7' then t:='yetti';
if copy(s,n,1)='8' then t:='sakkiz';
if copy(s,n,1)='9' then t:='to`qqiz';
label3.Caption:=label3.Caption+' '+t;end;
if n=2 then begin
Label2.Caption:='Bu ikki xonali son va u quyidagicha o`qiladi';
if copy(s,n-1,1)='1' then t:='o`n';
if copy(s,n-1,1)='2' then t:='yigirma';
if copy(s,n-1,1)='3' then t:='o`ttiz';
if copy(s,n-1,1)='4' then t:='qirq';
if copy(s,n-1,1)='5' then t:='ellik';
if copy(s,n-1,1)='6' then t:='oltmish';
if copy(s,n-1,1)='7' then t:='yetmish';
if copy(s,n-1,1)='8' then t:='sakson';
if copy(s,n-1,1)='9' then t:='to`qson';
label3.Caption:=label3.Caption+' '+t;
if copy(s,n,1)='1' then t:='bir';
if copy(s,n,1)='2' then t:='ikki';
if copy(s,n,1)='3' then t:='uch';
if copy(s,n,1)='4' then t:='to`rt';
if copy(s,n,1)='5' then t:='besh';
if copy(s,n,1)='6' then t:='olti';
if copy(s,n,1)='7' then t:='yetti';
if copy(s,n,1)='8' then t:='sakkiz';
if copy(s,n,1)='9' then t:='to`qqiz';
label3.Caption:=label3.Caption+' '+t;end;
if n=1 then begin
Label2.Caption:='Bu bir xonali son va u quyidagicha o`qiladi';
if copy(s,n,1)='1' then t:='bir';
if copy(s,n,1)='2' then t:='ikki';
if copy(s,n,1)='3' then t:='uch';
if copy(s,n,1)='4' then t:='to`rt';
if copy(s,n,1)='5' then t:='besh';
if copy(s,n,1)='6' then t:='olti';
if copy(s,n,1)='7' then t:='yetti';
if copy(s,n,1)='8' then t:='sakkiz';
if copy(s,n,1)='9' then t:='to`qqiz';
label3.Caption:=label3.Caption+' '+t;

end;end;

end.

5.17-masala. Tiyinlarda berilgan pulni so’m va tiyin bilan ifodalang. Bunda tiyinlar ikki xonali sonlar bilan ifodalanadi.

procedure TForm1.Button1Click(Sender: TObject);
var s:string[15];n:byte;
begin
s:=Edit1.Text;
n:=length(s); insert(' so`m ',s,n-1);
label2.Caption:=s+' tiyin';
end;

end.

838 marta o`qildi.

Foydalanuvchi ismi: Bektashev 102 gurux
Qo`shilgan sana: 2014-05-03

shaydullo aka shuni qogozga pechatga xam berish imkoniyati bormi saytizdan shoydullo@admin Nusha ko'chirib pechatga berish mumkin

Foydalanuvchi ismi: bektashev 102
Qo`shilgan sana: 2014-05-23

matnlarda ishlash uncha muamo emas ekan tshunarli ekan

Parol:
Eslab qolish.


Ro`yhatdan o`tish

testing

+998915878681

Siz o`z maxsulotingizni 3D reklama ko`rinishda bo`lishini xohlaysizmi? Unda xamkorlik qilamiz.

3D Reklama

testing

masalalar.zn.uz/

Turli xil mavzuda, internet mavzular, faqat masalalar.zn.uz saytda.


Рейтинг@Mail.ru
Рейтинг@Mail.ru

Besucherzahler
счетчик посещений