+ 2
Password checking doesn't work.
Hi! Im at very beggining of learning c++. I've just made this simple program which check if password is correct. Problem is output is always "Access granted". Can anyone show me what's wrong? Thanks! #include <iostream> using namespace std; int main() { int pass; cout << "Enter Password"<<endl; cin >>pass; if (pass=159875321){ cout <<"Access granted"<<endl; } else { cout<<"Access denied"<<endl; } return 0; }
2 Answers
+ 17
of course you forgot to add another equal sign for comparison '='
https://code.sololearn.com/cQn35AKp2QfI/?ref=app
+ 1
Big thanks!