Delphi 7编程

来源:百度知道 编辑:UC知道 时间:2024/06/23 02:51:02
我自己编了一个程序:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
Edit3: TEdit;
Label4: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
a,i,c,x:integer;
b:string[255];
begin
x:=StrtoInt(Edit1.text);
b:=(Edit2.text);
if (x=2) then a:=-a;
c:=Length(b);
for i:=1 to c do
b[i]:=chr(ord(b[i])+a);
end
Label4.Caption:=b[i];

Label4.Caption:=b[i];上面的end去掉。
即改为
procedure TForm1.Button1Click(Sender: TObject);
var
a,i,c,x:integer;
b:string[255];
begin
x:=StrtoInt(Edit1.text);
b:=(Edit2.text);
if (x=2) then a:=-a;
c:=Length(b);
for i:=1 to c do
b[i]:=chr(ord(b[i])+a);
//此处的end去掉
Label4.Caption:=b[i];
end;

end.

这种错误也会出现?不会吧