Simple C++ code doesn't work
Can anyone tell me why my code doesn't work. I'm simply doodling with C++ and because of some knowledge in PHP, I thought I could put together a simple login program.
Code:
#include <stdio.h>
#include <iostream.h>
int main() {
char username[10];
char password[10];
char user[10];
char pass[10];
"happy" == user;
"sad" == pass;
cout << "Please login. \n Username:";
cin >> username;
cout << "Password: ";
cin >> password;
if(user == username && pass == password) {
cout << "Login complete!";
}
else
{
cout << "Phail!";
}
}
No matter what I type in, it always returns PHAIL!, even if if I type in the correct username and password.