That is a little homework for myself. I was trying to make a simple program that you entry your name (acts as a password) and if it's on the list then you may access, otherwise (aka else) you're not allowed to access. The problem is I can't put more than two variables for one declaration (eg name == "James" || "Ellen" || "John") which || means OR, correct?
I can do the alternative: if (name = "James") {blah blah} else if (name = "Ellen") {blah blah, same as before one}, etc but that's long. I think OR operator would be easier but it doesn't work. Any suggestions?
#include <iostream>
#include <string.h>
using namespace std;
int main() {
string name;
cout << "Password: ";
cin >> name;
if (name == "James" || "Ellen" || "John")
{ cout << "\nCommander!\n"; }
else
{ cout << "\nDENIED!\n"; }
system("pause");
return 0;
}