hi ive just made my password console application but i cant get it to work can someone help me this is the code
#include <iostream>
#include <string>
using namespace std;
int main()
{
string a;
a= "word" ;// the password
string b;
cout<< "type your password";
cin>> b ;
if (a != b )
{
cout<<"wrong password"<<endl;
cout<<"change your password: yes/no"<<endl;
cin>>l;
if (b="yes")
{
cout<<"type the new password"<<endl;
cin>> a;//the new password
}
else if(b="no" )
goto c;
c:
return 0;
}
else if( a == b)
{
cout<<"welcome";
}
return 0;
}
thank you about the help
i have some other few questions
what should i do to change the password i mean that after i enter the new password ==> the password should change
In that case you have to store the password somewhere, possibly in a file. You probably want to hash the password so that no one can just open the file and read it.
First you should learn how to read and write from file.
To make something really safe is really hard so if this is just a toy project you might want to use something simple less secure. A good hash function + salt will protect against people stealing your password but if they have your program it wouldn't be hard to hack anyway. I'm not going to explain this in details.