Hi, I'm having problems with this practice problem and I need a little help.
The problem is:
"Modify your password program from before to put all of the password checking logic into a seperate function, apart from the rest of the program."
Here is my code:
Code:
#include <iostream>
#include <string>
using namespace std;
void password()
{
string checkpassword;
if (checkpassword == "taylor")
{
cout << "Access Allowed";
}
else
{
cout << "Wrong password";
}
}
int main()
{
cout << "Enter password: ";
cin >> password();
}
So far, I have gone over Variables, If/Else statements, Loops, and this chapter's topic of functions so my knowledge is a bit limited. All help will be appreciated.