void password(){
string fpass;
string pass;
cout << "Type the password " << endl;
getline(cin,pass);
cin.ignore();
ifstream fin(FILENAME1);
string str;
getline(fin, str);
fpass = str;
cin.ignore();
if (pass.compare(fpass) == 0){
cout << " Hello!" << endl << endl;
cout << "What do you want to do?" << endl;
}else{
cout << "\n\n INCORRECT! \n \n \n";
cin.ignore();
char choice;
cout << "Try again? y/n --> ";
cin >> choice;
if (choice == 'y'){
password();
}
}
}
What's the problem with this? It worked, but didn't do what I expected...