how would I trigger the bool to be true if the user imputed the correct thing in that case? and yes, I spaced on the double equals, I was messing about in vb last
That makes sense
I just wouldn't know how to set the password to then compare them (the user here wouldn't be setting the password, its just a basic setup where I set it in code and the user has to input it to be granted access access to nothing in this case, the code ends there)
that's really useful to know
I think I have it about right but Im missing something really simple I think
its telling me the that no operator exists for ==
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
#include <string>
#include <cstdlib>
usingnamespace std;
int main() {
string password = "thepassword";
string userPassword = "";
bool entry;
cout << "Please enter the password";
cin >> entry;
if (password == entry)
cout << "Acess granted";
}
@OP BTW the reason you were getting the == error is because at your line 12 password is a string and entry is a bool. == is expecting the same type both sides.