判断一个字符串不为空,象下面这样做为什么会编译通不过?(50分)

S

shuke

Unregistered / Unconfirmed
GUEST, unregistred user!
两个TEdit框, 用来设定密码,一个label,用来存放提示信息, 如果两个框都不为空且
Tedit1.Text=Tedit2.Text即认为是密码有效.可是下面这段程序编译时出错,你看看是什么原因.
begin
s1:=Tedit1.Text;
S2:=Tedit2.Text;
if s1=s2 and s1<>'' and s3<>'' then
Label1.Caption:='密码有效';
end;
 
begin
s1:=Tedit1.Text;
S2:=Tedit2.Text;
if (s1=s2) and (s1<>'') and (s3<>'') then
Label1.Caption:='密码有效';
end;
 
if (s1=s2) and (s1<>'') and (s3<>'') then
 
sorry,this is right:
begin
s1:=edit1.Text;
S2:=edit2.Text;
if (s1=s2) and (s1<>'') and (s3<>'') then
Label1.Caption:='密码有效';
end;
 
这种错误看一下错误提示就可以了,安装个金山词霸之类的,我就不信你看不懂。
这样的问题也上来问的话,你要多少分才够花啊?
 
估计楼主用c用惯了
不太习惯pascal这种特别严谨的语法
 
[red]符號的運算等級問題[/red]
 
楼主粗心了吧.
if (s1=s2) and (s1<>'') then
....
后面的(s3<>'')可以省略掉的.
 
我是Delphi初学者,也是大富翁的新手,谢谢大家的指教,我只恨我自己分太少,没法给大家多分一点儿 :) 以后还请大家多多关照
 

Similar threads

I
回复
0
查看
764
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
顶部