
лабораторная работа / лабораторные работы по ASSAMBLER / 4 лаба отчет
.docxВ строке, состоящей из русских букв, подсчитать отдельно количество прописных и количество строчных букв
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons;
type
{ TForm1 }
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
ListBox1: TListBox;
procedure Edit1KeyPress(Sender: TObject; var Key: char);
procedure FormKeyPress(Sender: TObject; var Key: char);
procedure ListBox1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: char);
begin
if key=#13 then
begin
ListBox1.Items.Add(Edit1.Text);
Edit1.Text:='';
end;
end;
procedure TForm1.FormKeyPress(Sender: TObject; var Key: char);
begin
end;
procedure TForm1.ListBox1Click(Sender: TObject);
var
st: string;
i,stroc,zaglav,nst: integer;
begin
zaglav:=0;
stroc:=0;
nst:=ListBox1.ItemIndex;
st:=ListBox1.Items[nst];
for i:=1 to Length(st) do
if st[i]<>' ' then
if (st[i]='А') or (st[i]='Б') or (st[i]='В') or (st[i]='Г') or (st[i]='Д') or (st[i]='Е') or (st[i]='Ё') or (st[i]='Ж') or (st[i]='З') or (st[i]='И') or (st[i]='Й') or (st[i]='К') or (st[i]='Л') or (st[i]='М') or (st[i]='Н') or (st[i]='О') or (st[i]='П') or (st[i]='Р') or (st[i]='С') or (st[i]='Т') or (st[i]='У') or (st[i]='Ф') or (st[i]='Х') or (st[i]='Ц') or (st[i]='Ч') or (st[i]='Ш') or (st[i]='Щ') or (st[i]='Ъ') or (st[i]='Ы') or (st[i]='Ь') or (st[i]='Э') or (st[i]='Ю') or (st[i]='Я') then
begin
zaglav:=zaglav+1;
end
else stroc:=stroc+1;
Label1.Caption:=IntToStr(zaglav);
Label2.Caption:=IntToStr(stroc);
end;
initialization
{$I unit1.lrs}
end.