Hi, kinda stuck trying to make a simple password checker which uses a function to check the password.
When i run the program and then enter the password it come up with an error and shuts down the program. I think this may have something to do with the fact that i have not specified a return value but I a not sure.
Could someone please explain to me what I am doing wrong here?
Code:
#include <iostream>
#include <string>
using namespace std;
string password;
int x;
string password_checker( string password )
{
if ( password == "donkey" )
{
x = 16;
}
}
int main ()
{
while ( x != 16 )
{
cout <<"PLEASE ENTER THE PASSWORD: ";
cin >> password;
password_checker( password );
cout <<"\n\n\n";
}
cout <<"\n\n\n\n WELCOME";
}
Thanks