Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Turing ATM machine
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
avsrule192002




PostPosted: 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 Question plzzzzzzzzzzzz help me
Sponsor
Sponsor
Sponsor
sponsor
codemage




PostPosted: 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"
...
jamonathin




PostPosted: 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.
Jorbalax




PostPosted: 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.
codemage




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: