Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

Can anyone give me a sample password verification program in c++? The user should type a password and the compiler should check if its right or wrong and display. -- advance thanks.

OpenStudy (owlfred):

Hoot! You just asked your first question! Hang tight while I find people to answer it for you. You can thank people who give you good answers by clicking the 'Good Answer' button on the right!

OpenStudy (anonymous):

You mean when user types password should be shown in screen ????if not it is just like comparing two strings using strcmp

OpenStudy (anonymous):

the original password is already in the program. the compiler just need to verify if the user entered password is right.

OpenStudy (anonymous):

#others like stdio and all include <string> int main() { string s1,s2; #lets consider s1 has password and s2 has entered password. if(s1.compare(s2)==0) { #print equal } else { do whatever you want } return 0; }

OpenStudy (anonymous):

ya but how to compare two arrays? (one array is the original password and the other one is the one entered by the user.)

OpenStudy (anonymous):

hello?

OpenStudy (anonymous):

you mean char a[34],b[45]; if (strcmp(a,b)==0) print true else print false

OpenStudy (anonymous):

thanks

OpenStudy (anonymous):

@geo:I would like to know more about the result,don't forget to use string header file(<string>

OpenStudy (anonymous):

ok

OpenStudy (anonymous):

strcpy didnt work it is just comparing the first letter of the password. not the entire string. can you please give the c++ program for this?

OpenStudy (anonymous):

hello

OpenStudy (anonymous):

thanks a lot

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!