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

Username:   Password: 
 RegisterRegister   
 Need help with password
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
KONjbnj




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
mksound




PostPosted: Wed Apr 27, 2005 8:41 am   Post subject: re

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




PostPosted: Wed Apr 27, 2005 9:01 am   Post subject: (No 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
KONjbnj




PostPosted: Wed Apr 27, 2005 1:36 pm   Post subject: (No 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
jamonathin




PostPosted: Wed Apr 27, 2005 1:40 pm   Post subject: (No 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 ***
KONjbnj




PostPosted: Wed Apr 27, 2005 1:45 pm   Post subject: (No subject)

I still dont get it that much plz help
jamonathin




PostPosted: Wed Apr 27, 2005 1:51 pm   Post subject: (No 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.
Bacchus




PostPosted: Wed Apr 27, 2005 6:36 pm   Post subject: (No 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
Sponsor
Sponsor
Sponsor
sponsor
McKenzie




PostPosted: Wed Apr 27, 2005 6:50 pm   Post subject: (No subject)

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




PostPosted: Wed Apr 27, 2005 8:45 pm   Post subject: (No subject)

wat does noecho do??
Bacchus




PostPosted: Wed Apr 27, 2005 8:55 pm   Post subject: (No subject)

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




PostPosted: Wed Apr 27, 2005 11:20 pm   Post subject: (No subject)

with getch, it doesn't put the letters on the screen anyway
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  [ 12 Posts ]
Jump to:   


Style:  
Search: