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

Username:   Password: 
 RegisterRegister   
 Password program help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
con.focus




PostPosted: Sat Jan 08, 2005 4:36 pm   Post subject: Password program help

K im make a pass word file that covers the password over with stars
the program has a big problem

which is if an incorect password is enter first it will and then the corect password is entered it does n't reconize it

this does not happen when the correct pwd is enter the first time
code:
var key : string (1)
var password : string := ""
var counter : int
counter := 0
loop
    loop
        getch (key)
        exit when ord (key) = 10
        put "*" ..
        password += key
    end loop
    put ""
    counter += +1
    if counter = 3 then
        quit
    elsif password = "sze" then
        exit
    end if
end loop
put ""
put "Welcome to Scotia Bank"


can ne 1 help
Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Sat Jan 08, 2005 4:44 pm   Post subject: (No subject)

dont do it that way
just use setscreen("noecho")
and then everytime a key is pressed, output a "*"
con.focus




PostPosted: Sat Jan 08, 2005 4:49 pm   Post subject: (No subject)

wut exactly do u mean
Andy




PostPosted: Sat Jan 08, 2005 4:54 pm   Post subject: (No subject)

make a new program, and at the very top put setscreen("noecho")
and then write a program that gets someones name, run it and u'llsee what i mean
con.focus




PostPosted: Sat Jan 08, 2005 4:57 pm   Post subject: (No subject)

i did that but the only thing it write at is enter wont lets u inout other chars


btw is there a command that will resart ur program
Andy




PostPosted: Sat Jan 08, 2005 5:05 pm   Post subject: (No subject)

err u can put it in a loop.. or u can make it an exe and use Sys.Execute

and btw... that program i told you to write dos input letters, you just cant see it being inputted which is the whole point of hiding it.. ah wells, here is a password program i wrote a while back

code:

fcn getpass : string
    var pass := ""
    var charc : string (1)
    loop
        getch (charc)
        exit when ord (charc) = 10
        if ord (charc) = 8 and length (pass) not= 0 then
            locate (whatrow, whatcol - 1)
            put " " ..
            locate (whatrow, whatcol - 1)
            pass := pass (1 .. length (pass) - 1)
        elsif ord (charc) not= 8 then
            pass := pass + charc
            put "*" ..
        end if
    end loop
    put ""
    result pass
end getpass

put getpass
con.focus




PostPosted: Sat Jan 08, 2005 5:27 pm   Post subject: (No subject)

yo thx ne way but i just realized that this line
code:
password+= key

is acting like this one
code:
counter += +1

all i needed to do was reset the variable at the end of the loop
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  [ 7 Posts ]
Jump to:   


Style:  
Search: