Дан текст на русском языке. Напечатать в алфавитном порядке все глухие согласные буквы, которые не входят хотя бы в одно слово.
У меня она хорошо работает, но для всей строки, а как можно сделать так чтобы для каждого слова выводились отсутствующие глухие? Может кто знает?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Memo1: TMemo;
Button1: TButton;
Label1: TLabel;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
const
a : array[0..9] of char = ('к','п','с','т','ф','х','ц','ч','ш','щ');
var
i : Integer;
begin
for i := 0 to 9 do
if pos(a, AnsiLowerCase(Edit1.Text)) = 0 then Memo1.Lines.Add(a);
end;
буковки
Модераторы: Duncon, Naeel Maqsudov, Игорь Акопян, Хыиуду
- Naeel Maqsudov
- Сообщения: 2570
- Зарегистрирован: 20 фев 2004, 19:17
- Откуда: Moscow, Russia
- Контактная информация:
Код: Выделить всё
const
word_delim: set of char = {' ',':',',','.','!',';','?'} //разделители слов
a : array[0..9] of char = ('к','п','с','т','ф','х','ц','ч','ш','щ');
i,j:integer;
begin
for i := 0 to 9 do begin
ai_count:=0; wordlen:=0;
for j:= 1 to Length(Edit1.Text) do begin
if a[i]=AnsiLowerCase(Edit1.Text[j]) then inc(ai_count);
if Edit1.Text[j] in word_delim then begin
if (ai_count = 0) and (wordlen>0) then begin
Memo1.Lines.Add(a[i]);
ai_count:=0; wordlen:=0;
Continue;
end;
wordlen:=0;
end else inc(wordlen);
end;
end;
end;