注册 登录
编程论坛 Delphi论坛

新手请教,一个程序调试问题

山高水长 发布于 2006-04-15 21:59, 592 次点击

unit Unit5;

interface

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

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

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
r,c,s:real;
const pi=3.141596;
begin
r:=StrToFloat(Edit1.Text);
C:=2*pi*r;
s:=pi*sqr(r);
Label2.Caption:='圆的周长为:'+FloatToStr(c)+' '+Chr(13)+'面积为:
'+FloatToStr(s);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;

end.




刚学D,从书上找了个小程序练习一下,结果提示出现这么三个问题,请高手指点一下!万分感谢!!
[Error] Unit5.pas(39): Unterminated string
[Error] Unit5.pas(40): Unterminated string

[Fatal Error] Project5.dpr(5): Could not compile used unit 'Unit5.pas'

2 回复
#2
ysp_19842006-04-16 14:11
Label2.Caption:='圆的周长为:'+FloatToStr(c)+' '+Chr(13)+'面积为:
'+FloatToStr(s);
这一句错了.要么这样写:
Label2.Caption:='圆的周长为:'+FloatToStr(c)+' '+Chr(13)+'面为:'+FloatToStr(s);
要么这样:
Label2.Caption:='圆的周长为:'+FloatToStr(c)+' '+Chr(13)+'面为:'
+FloatToStr(s);
总之,'面积为:
'两个分号在同一行上.
#3
山高水长2006-04-16 21:37

我试了,问题解决了!
高手就是高手,非常感谢!!!

1