How can i comepare two strings?

Hi, I am making a C++ program which stores passwords and account information. It is in the console as I'm making it to practice as I am very new to C++.

What I want to do is let the user enter a password and compare the user entered password to the correct one in the program. Then if the password is correct and matches the stored password then the program continues.

Got any ideas? I've have tried myself but haven't got a working code.

For example: if I had this char Char password[9] = "123456789"; and then char user_entered_password[80];- how would I compare them to see if they were to same?
For the char user_entered_password[80]; I would use cin >> user_entered_password[80]; to get the value for this variable.

Thanks!

Last edited on
You might as well just use C++ strings and then you can compare them directly with ==.
http://www.cplusplus.com/reference/string/string/

Otherwise..
http://www.cplusplus.com/reference/cstring/strcmp/
to compare use this code
if (strcmp (password,user_entered_password)==0)
cout<<"Password Match";
else
cout<<"Not the Same";
Thanks guys, I used both of your answers!
Topic archived. No new replies allowed.