If statement not working

I revised a simple program to add new elements to see if I could get the OR logical operator, and if statements working together, but it doesn't seem to work. Not sure what the problem is, but it's not displaying the else area of the program, it's over looked.

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

#include <iostream>
#include <string>
using namespace std;
int main ()
{
	string Jesus;
	cout << "please enter your saviours name: ";
	getline(cin, Jesus);
	if (Jesus == "Jesus" || "jesus")
	{
	cout << "Amen!";
	}
	else
	{
	cout << "Jesus is the living God. \n";
	}
	return 0;
}
Last edited on
if (Jesus == "Jesus" || "jesus") won't work.
You have to think of it this way - you don't code if (variable == answer || answer2); Instead you have to compare variable to all options - if (variable == answer || variable == answer2);
hey, that worked perfectly, thanks for the help. Actually made things seem clear.
Topic archived. No new replies allowed.