Citat:unit Unit1;
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
s,s1:string;
k,p:integer;
begin
s:=memo1.Text;
k:=0;
while pos(' ',s)<>0 do
begin
p:=pos(' ',s);
s1:=copy(s,1,p);
if (s1[1]='A') or (s1[1]='a') then k:=k+1;
Delete(s,1,p);
end;
edit1.Text:=inttostr(k);
end;
end.
Ne mogu nigde da nadjem gresku. Rezultat treba da bude npr. da kad upise tri imena sa pocetnim slovom a da rezultat bude tri. Npr upisao sam dva imena sa pocetnim slovom a i rezultat je 1. Hvala unapred na pomoci.
|