how to make a simple password lock in c++??
i want a alphabetic lock
btw thanks for helping
Can you please clarify? You want to have a prompt such as :
"Enter the password: "
and then check if the password that is entered is correct? Depending on the security level needed, you could just hardcode the password in the code and do a string comparison. Another common feature would be to "mask" the password that is entered (with *'s perhaps), but I don't know how to go about that.
Dave
i want to have a prompt such as :
"Enter the password: "
I think it's inpossible to replace typed letters/numbers with a '*' in c++, however you could get keyboard input directly with kb_hit(). To use the function kb_hit() you need to have the C header 'conio.h'.
#include <conio.h>
For example;
char example[10]
if (kb_hit()==TRUE) {
example=getchar();
}
If you use kb_hit(), and system('cls') you will be able to clear the typed characters straight away so that they do not appear. By the way, I think using a character array like that doesn't work, so sorry.
ylin333 anyway thanks for helpp!!!!!!!!!!!!!!!!
No problem. I'm not entirely confident about that code since it has been a while I used a function of that type. If there are any problems feel free to ask me or you can Google it.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.