mardi 4 octobre 2016

if statment not working with 3rd condition having 2 OR options

I want to get result only when all 3 conditions are fullfilled, code works good when 3rd has only one option ex "smith" but taking only 1 condition if 3rd has 2 or more ex "smith"||"Smith"

#include <iostream>
using namespace std;

int main()
{
    int age;
    string name;
    string lastname;
    cout << "Podaj swoje imie" << endl;
    cin >> name;
    cout << "Podaj swoje nazwisko" << endl;
    cin >> lastname;
    cout << "Wprowadz swoj wiek" << endl;
    cin >> age;
    cout << "Imie: ";
    cout << name << endl;
    cout << "Nazwisko: ";
    cout << lastname << endl;
    cout << "Wiek: ";
    cout << age << endl;
    if (age < 18)
    {
        cout << "you're too young";
    }
    else
    {
        cout << "you can drink" << endl;
    }
    if ((age == 27)
            && (name == "katarzyna" || "kasia" || "Katarzyna" || "Kasia")
            && (lastname == "smith" || "Smith"))
    {
        cout << "BOOM" << endl;
        cout << "BOOM";
    }
}

Aucun commentaire:

Enregistrer un commentaire