vendredi 6 février 2015

My if statement with char isn't working, any ideas?

Here is my code



char un [50] = "Username";
char pw [50]= "Password";
char unapp[50];
char pwapp[50];

cout << "Username: ";
cin >> unapp;
system("CLS");
cout << "Username: ";
cout << unapp <<endl;
cout << "Password: ";
cin >> pwapp;
system ("pause");

if (unapp == un)
{
cout <<"Gz" <<endl;
system ("pause");
}

cout << unapp <<endl;
cout << un <<endl;

system ("pause");

return 0;


For some reason it does not run the if statement even though after that I have printed both the unapp and un to see if they are the same and sure enough they are but still nothing?? It works if I use int's. Help please


Aucun commentaire:

Enregistrer un commentaire