
-----------------------------------
avsrule192002
Thu Oct 13, 2005 11:14 am

Turing ATM machine
-----------------------------------
How do i do a pin number code so that as i type the number no number shows up but an X instead :?:  plzzzzzzzzzzzz help me

-----------------------------------
codemage
Thu Oct 13, 2005 12:28 pm


-----------------------------------
Don't use "get" to accept characters.


PSEUDO

var pass : array...

for x : 1..length of pass
 pass(x) := getchar
 put "x"
...


-----------------------------------
jamonathin
Thu Oct 13, 2005 1:27 pm


-----------------------------------
Well, first off.  This is the Turing Source Code area, this is where you post your own code to show to otehr people.  You should have asked in the Turing Help Forum (two up).

Secondly, what's wrong with that code is that you assign it to a regular array.  How would you know how long the password is?  Besides the fact a pin number is 4 long.. .

if you wanted to use an array you could use a flexible array where you change the upper everytime you type in a letter, or you could use some of the techniques such as [url=http://www.compsci.ca/v2/viewtopic.php?t=9751]this.

-----------------------------------
Jorbalax
Thu Oct 13, 2005 11:30 pm


-----------------------------------
Alternatively, you could do this.

var input : char
var inputstring : string := ""

loop
input := getchar
exit when input = KEY_ENTER
put "*"..
inputstring +=input
end loop


A bit more simple, if you aren't into flexible array's and whatnot yet.  Of course, doing it with flexible array's would likely be a better choice; less tedious, in my opinion.

-----------------------------------
codemage
Fri Oct 14, 2005 9:24 am


-----------------------------------
Judging by the experience level of the user, I was assuming it would be ok to have a fixed size array for a fixed size pin number.

No sense scaring off a newb.
