在此奉上程序:
uses crt;
var
i,x,y,qqx:longint;
s:boolean; ch:char; mm,ff:string;
begin
gotoxy(1,1);clrscr;
write('请输入密码:');
while true do
begin
s:=true;
ch:=readkey;
case ch of
#8:begin
x:=wherex;
y:=wherey;
if x=1 then
begin
dec(y);
x:=qqx;
end else
if (x>1)and((x>10)or(y>1)) then dec(x);
gotoxy(x,y);
write(' ');
gotoxy(x,y);
s:=false;
ff:=copy(mm,1,length(mm)-1);
mm:=ff;
end;
#13,#10:begin
writeln; s:=false;
if mm='123456' then
begin
writeln('登录成功!');
readln;
break;
end
else
begin
write('密码错误!请重新输入:'); mm:='';
end;
end;
end;
if s then begin mm:=mm+ch; write('*'); end;
end;
writeln('......');//登录后想干什么
readln;
end.
(备注:此处密码默认为123456,可自行调整)
uses crt;
var
i,x,y,qqx:longint;
s:boolean; ch:char; mm,ff:string;
begin
gotoxy(1,1);clrscr;
write('请输入密码:');
while true do
begin
s:=true;
ch:=readkey;
case ch of
#8:begin
x:=wherex;
y:=wherey;
if x=1 then
begin
dec(y);
x:=qqx;
end else
if (x>1)and((x>10)or(y>1)) then dec(x);
gotoxy(x,y);
write(' ');
gotoxy(x,y);
s:=false;
ff:=copy(mm,1,length(mm)-1);
mm:=ff;
end;
#13,#10:begin
writeln; s:=false;
if mm='123456' then
begin
writeln('登录成功!');
readln;
break;
end
else
begin
write('密码错误!请重新输入:'); mm:='';
end;
end;
end;
if s then begin mm:=mm+ch; write('*'); end;
end;
writeln('......');//登录后想干什么
readln;
end.
(备注:此处密码默认为123456,可自行调整)