Qbasicnews.com
passwords - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html)
+--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html)
+--- Thread: passwords (/thread-1990.html)

Pages: 1 2


passwords - speedlemon - 09-13-2003

how would i go about making it so when you type something in, the letters are replaced by a *?

:bounce:


passwords - Agamemnus - 09-13-2003

Use INKEY$.


passwords - Flexibal - 09-13-2003

Code:
CLS
b$ = ""
y = 1

LOCATE y
PRINT "_"

DO
   a$ = ""
   WHILE a$ = ""
      a$ = INKEY$
   WEND

   SELECT CASE a$
      CASE CHR$(13)
         EXIT DO
      CASE CHR$(27)
         b$ = ""
      CASE CHR$(8)
         IF b$ = "" THEN
            BEEP
         ELSE
            b$ = MID$(b$, 1, LEN(b$) - 1)
         END IF
      CASE ELSE
         b$ = b$ + a$
   END SELECT

   LOCATE y
   PRINT STRING$(LEN(b$), "*"); "_"; SPACE$(78 - LEN(b$))
LOOP



passwords - oracle - 09-13-2003

This problem has been done so many times now... I even held a challenge here to simulate a password thing (which I think Meg won with a "matrix" password thing). Check the challenge thread for all the problems you could have with password things, and the solutions people came up with Smile


passwords - whitetiger0990 - 09-13-2003

flex: Your code only prints the letter typed to make it print '*' you need this
Code:
CLS
b$ = ""
y = 1
DO
    a$ = ""
    WHILE a$ = ""
        a$ = INKEY$
    WEND
    SELECT CASE a$
       CASE CHR$(13)
            EXIT DO
       CASE CHR$(27)
            b$ = ""
        CASE CHR$(8)
            IF b$ = "" THEN
                BEEP
            ELSE
                b$ = MID$(b$, 1, LEN(b$) - 1)
            END IF
        CASE ELSE
            b$ = b$ + "*"
            c$ = c$ + a$
    END SELECT

    LOCATE y: PRINT b$; SPACE$(80 - LEN(b$))
LOOP
PRINT c$



passwords - Flexibal - 09-13-2003

i edited my code just to add a cursor marker... but come on, if you can't see why my code is fine... then you need some professional help Smile




[Flexibal>


passwords - whitetiger0990 - 09-13-2003

Quote:i edited my code just to add a cursor marker... but come on, if you can't see why my code is fine... then you need some professional help Smile




[Flexibal>
oh. nvm. yours is still better


passwords - Flexibal - 09-13-2003

*flattered*
:bounce:





[Flexibal>


passwords - speedlemon - 09-13-2003

thx


passwords - ak00ma - 09-13-2003

Here's another one: (submitted to Q-Tech by Zack)

Code:
CLS
PRINT "Enter Password: ";
row = 1
col = 17
LOCATE row, col
DO
press$ = INKEY$
IF press$ <> "" AND press$ <> CHR$(8) THEN
IF press$ = CHR$(13) THEN EXIT DO
LOCATE row, col
PRINT "*";
pswd$ = pswd$ + press$
col = col + 1
LOCATE row, col
END IF
IF press$ = CHR$(8) AND col - 1 >= 17 THEN
a$ = LEFT$(pswd$, LEN(pswd$) - 1)
col = col - 1
LOCATE row, col: PRINT " ";
pswd$ = a$
END IF
LOOP