Procedure inputpassword(var s:string;ch:char); var c:char; begin s:=''; cursoron; repeat c:=readkey; if (c<> #13) and (c<># 0) and (ord(c) in [32..126]=false) then continue; if (c= #13) or ((c=# 0) and (readkey=#28)) then break; if c=chr(8) then begin if s='' then continue; gotoxy(wherex-1,wherey); write(' '); gotoxy(wherex-1,wherey); delete(s,length(s),1); continue; end; if length(s)=maxlengthofpassword then continue; s:=s+c; write(ch); until false; writeln; cursoroff; end;
我是这么做到的 打的简单一点 program e; uses crt; var ch:char; a:string; i:integer; begin i:=0n repeat ch:=readkey; i:=i+1; a[i]:=ch; until 这里怎么写; end. 而且不知为什么ch可以被读入,但ch无法赋值给a