unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
pwdfile:textfile;
namestr,pwdstr:string[8];
i:integer ;
begin
assignfile(pwdfile,'e:\pwd.txt');
reset(pwdfile); readln(pwdfile,namestr);
readln(pwdfile,pwdstr); closefile (pwdfile);
if namestr=edit1.Text then label1.Caption :='ok';
if pwdstr=edit2.Text then label2.caption:='ok';
edit3.Text :=namestr;
edit4.Text :=pwdstr; end;
end.//为什么把pwd 文本中的密码可以比较相等,而用户名一直是不相等....//edit1 输入用户名,edit2 输入密码,edit3显示用户 edit4 显示密码;
edit3显示的和edit1一样,去比较不相等......
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
pwdfile:textfile;
namestr,pwdstr:string[8];
i:integer ;
begin
assignfile(pwdfile,'e:\pwd.txt');
reset(pwdfile); readln(pwdfile,namestr);
readln(pwdfile,pwdstr); closefile (pwdfile);
if namestr=edit1.Text then label1.Caption :='ok';
if pwdstr=edit2.Text then label2.caption:='ok';
edit3.Text :=namestr;
edit4.Text :=pwdstr; end;
end.//为什么把pwd 文本中的密码可以比较相等,而用户名一直是不相等....//edit1 输入用户名,edit2 输入密码,edit3显示用户 edit4 显示密码;
edit3显示的和edit1一样,去比较不相等......
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货