I want to compare my password with the stored password but it don't compare correctly. WHY?
Please someone correct it.
#include <iostream>
#include <string.h>
#include <conio.h>
#include <cstdlib>
using namespace std;
int main() {
string my = "programming ";
string pass = "";
int s;
int a;
cout << "Enter password: ";
do {
// backspace not allowed
a = _getch();
pass += char(a);
cout << "*";
}while( a != 13 );
cout << endl << "Password is: " << pass << endl;
cerr << " \n My: " << my << " \n ";
//s = strlen(pass);
//cerr << " Size: " << s;
//if ( strcmp ( pass , my ) == 0 ) {
if ( pass == my ) {
cerr << "\n\n \t Password Comfirmed";
} else {
cerr << "\n\n \t Not Confirmed";
}
system("pause");
return 0;
}