why doesn't this work?
int main()
{
fstream file;
char output[100], pasword[100];
int a;
const string x("Yes");
const string y("No");
string z;
char b;
cout << "\nEnter correct password to continue: \n" << endl;
cin.getline(output, 15);
if(output == "file.txt")
{
cout << "Change password? Type Yes or No. \n" << endl;
cin >> z;
if(z == x)
{
cout << "\nEnter current password: \n" << endl;
cin >> b;
if(b == "file.txt")
{
cout << "\nEnter new password:\n" << endl;
file.open("file.txt");
file >> output;
file.close();
cout << "\nVerify new password:\n" << endl;
file.open("file.txt");
file >> pasword;
file.close();
if(output == pasword)
{
cout << "\nPassword change complete.\n" << endl;
main2(); }
else
{ cout << "\nPasswords do not match.\n" << endl;
main(); }
}}
if(z == y)
{
main2();
}
else
{
cout << "\nIncorrect password.\n" << endl;
main(); }
}
else
{cout << "\nIncorrect password.\n" << endl;
main();}
cin.clear();
cin.ignore(255, '\n');
cin.get();
return 0;
main2();
return 0;
}
(by the way main2() is the actual program, main in itself is basically the authentication function)
I basically want the contents of the file 'file' to be the password, so that the password can be changed remotely, from someone using the program, not the programmer themself.