Computer Science Canada

Need help with password

Author:  KONjbnj [ Wed Apr 27, 2005 8:12 am ]
Post subject:  Need help with password

I need to create a program that when i need to get something from the user it puts it in asterisks like a password (like when you log into hotmail)


Thanks
KonjBnj

Author:  mksound [ Wed Apr 27, 2005 8:41 am ]
Post subject:  re

hmm............... figure it out.....

Author:  jamonathin [ Wed Apr 27, 2005 9:01 am ]
Post subject: 

You need to var something : string := "" (equal to nothing)
then you need to var something_else: string (1)
Now you need to use getch, and whenever the user inputs a letter, clear last screen, and add the input to something. Then use a for loop that uses the length of something, and have it display "*" or whatever for how many times it goes through that for loop. And just have the program exit when enter is elsected or something.
** The program must be looped **
mksound wrote:
hmm............... figure it out.....

Those are words spoken of someone who doesn't know the answer himself. Razz

Author:  KONjbnj [ Wed Apr 27, 2005 1:36 pm ]
Post subject: 

Ok that makes sense just that im still a noob at turing and dont know things like getch so can you plz show the source code or part of it


Thanks
KonjBnj

Author:  jamonathin [ Wed Apr 27, 2005 1:40 pm ]
Post subject: 

Here's a tip.
Turing:

getch (hold)
cls
thing += hold

Look up getch to see what type of variable you need, and remember that thing stores hold.

*** Hit F10 ***

Author:  KONjbnj [ Wed Apr 27, 2005 1:45 pm ]
Post subject: 

I still dont get it that much plz help

Author:  jamonathin [ Wed Apr 27, 2005 1:51 pm ]
Post subject: 

You're not gettin any more source code after this. Look up the vars and whatnot, and when you go to replace the letters, use a for loop like this.
code:
for i : 1 .. length (thing)

Reason you want to display however many letters there are in the password with *'s. The reason I'm not giving you any mre source code, is because there isn't much left, and this sounds like an assignment for school.

Author:  Bacchus [ Wed Apr 27, 2005 6:36 pm ]
Post subject: 

Turing:
var letter:string(1) %this declares the variable to hold the tmp letter
var password:string:="" %setting a blank var to nothing to hold pass
loop
getch(letter) %this will get the letter you want
password+=letter %after done, this will hold what they inputted
put "*".. %puts the asterixs for each things they type
end loop
i didnt do all, liek you would want a way to exit the loop, check ord in f10 and figure out Razz

Author:  McKenzie [ Wed Apr 27, 2005 6:50 pm ]
Post subject: 

Make sure you set your screen to noecho or you will defeat the purpose:
code:
View.Set("noecho")

Author:  mike200015 [ Wed Apr 27, 2005 8:45 pm ]
Post subject: 

wat does noecho do??

Author:  Bacchus [ Wed Apr 27, 2005 8:55 pm ]
Post subject: 

if u use getch or get then it wont put the letters on the screen when you press the key

Author:  mike200015 [ Wed Apr 27, 2005 11:20 pm ]
Post subject: 

with getch, it doesn't put the letters on the screen anyway


: