unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
s1: string;
Procedure odwroc_wyraz (s:string) ;
function czy_palindrom(s_1,s_2: string) :boolean;
implementation
{$R *.dfm}
Procedure odwroc_wyraz (s:string) ;
var i,x : integer;
begin
x:=length(s);
s1:=' ';
for i := x downto 1 do
begin
s1:= s1 + s[i];
end;
end;
function czy_palindron(s_1,s_2: string) :boolean;
begin
if(s_1=s_2) then result:= true else result:=false;
end;
procedure TForm1.Button1Click(Sender: TObject );
begin
odwroc_wyraz(edit1.Text);
label1.Caption:=s1;
if(czy_palindrom(edit1.Text,s1)) then button1.Caption:= 'to jest palindrom' else button1.Caption:= 'to nie jest palindrom'
end;
end.
Po włączeniu programu i wpisaniu np sos w edicie, na przycisku wyświetla się "to nie jest palindrom" a powinno być odwrotnie.
Gdzie zrobiłem błąd?