Help! simple if and else statement password!

I'm trying to make a simple password using if and else statement. My problem is It keeps saying "Access Allowed" even though I put a wrong number. help please.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  #include <iostream>

using namespace std;

int main()
{
	int pass;
	
	cout << "Please type in the password." << endl;
	cin >> pass;

	if (pass == 45 || 65)
	{
		cout << "Access Allowed!" << endl;
	}
	else
	{
		cout << "Access Denied";
	}
}
Operator precedence. op== is evaluated before op||.
1
2
3
4
5
6
pass == 45 || 65
// is same as
(pass == 45) || 65

// Try
(pass == 45) || (pass == 65)
Wow! Thank you very much! I'm trying to figure it out for about 30 minutes.
Topic archived. No new replies allowed.