Turing ATM machine
Author |
Message |
avsrule192002
|
Posted: Thu Oct 13, 2005 11:14 am Post subject: 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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
codemage
![](http://usera.imagecave.com/codemage/codemage-small.gif)
|
Posted: Thu Oct 13, 2005 12:28 pm Post subject: (No subject) |
|
|
Don't use "get" to accept characters.
PSEUDO
code: |
var pass : array...
for x : 1..length of pass
pass(x) := getchar
put "x"
...
|
|
|
|
|
|
![](images/spacer.gif) |
jamonathin
![](http://compsci.ca/v3/uploads/user_avatars/57683465145f851a43dd9a.gif)
|
Posted: Thu Oct 13, 2005 1:27 pm Post subject: (No subject) |
|
|
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 this. |
|
|
|
|
![](images/spacer.gif) |
Jorbalax
![](http://usera.imagecave.com/Jorbalax/Signatures-Avatars/mrshroomyblue.png)
|
Posted: Thu Oct 13, 2005 11:30 pm Post subject: (No subject) |
|
|
Alternatively, you could do this.
code: |
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. |
|
|
|
|
![](images/spacer.gif) |
codemage
![](http://usera.imagecave.com/codemage/codemage-small.gif)
|
Posted: Fri Oct 14, 2005 9:24 am Post subject: (No subject) |
|
|
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. |
|
|
|
|
![](images/spacer.gif) |
|
|