I just began learning C++ about a week ago and have ran into a very strange problem. I was writing a database program and was adding password protection to it...only problem was, it didn't work. lol. So I made a VERY simple passgate to see what my problem was. About 2 hours later, I'm still working on it and making no real progress. Its kinda embarrasing to ask because its such a simple program, but I just am not seeing the solution.
OUTPUT:Code:#include <iostream.h> int passcheck(char password[100]); int passcheck(char password[100]) { char correct[100] = "swordfish"; if (password == correct) return 1; else cout << "\nWhat you typed: " << password; cout << "\nWhat you should have typed: " << correct; return 0; } int main() { char password[100]; cout << "\nPassword: "; cin >> password; passcheck(password); cout << "\nExiting..."; return 0; }
Password:
What you typed: swordfish
What you should have typed: swordfish
Exiting...
Maybe its just me, but I find it odd that it says I've typed in the right password, but that its somehow wrong. Any help would be appreciated.