i named the program 7-pass.cpp.
Modify your password program from before to put all of the password checking logic into a
separate function, apart from the rest of the program.
Code:
#include<iostream>
#include<string>
using namespace std;
string passcheck(string check)
{
string pass;
pass=("abcd");
if(pass==check)
{
cout<<"access granted!";
}
else
{
cout<<"acess denied!";
}
}
int main()
{
string password;
cout<<"enter your password:\n";
cin>>password;
cout<<passcheck(password);
}
the program runs and displays the results correctly but everytime it shows 7-pass.exe has stopped working.is something wrong?