Hi, my program requires a username and password to gain access. I need to mask the password input with *. I have researched heaps and found codes that don't work for what I want.
After the user enters the password, it is checked against a password already stored. the password is string 'alpha'.
Below is the login section of the program.Any help would be fantastic.
What this does is... It has 2 strings beta&Alpha and it opens the login where it asks u for a username and password... Once u type the username and password... it checks if the username typed is Guest and if the password is Guest..
if(beta != "Guest" || alpha != "Guest") so what this says is
if Username is not Guest And Password is not Guest return 1 aka exit
else ... so what the else means here is If both are correct it will proceed :)
You could also store the usernames and passwords in a text file and read them, but anyone can find the text file and change it and gain access :)
There is no one way to hide what the user is typing; C++ has no knowledge of what a keyboard or a screen is. That sort of thing is handled by your operating system, so you need to use libraries beyond the C++ standard.
I was expecting u :)
Yes it does and you are right :)
I learnt C++ on my own and the problem is that i skipped some parts and i have been in a situation where people asked me something and idk what that is but i only don't know the names of the functions :)
Btw i am working on a game and i'm stuck at the map a little i could use some help if anyone is interested :)
Thanks for all your replies. but something still doesn't work.
these codes store the password as a char and therefore I can't test it against my string. I need to convert the char into a string.
if you need the rest of the code, please ask.