dimanche 14 novembre 2021

How do I get C++ to stop ignoring my else statement [closed]

I have this program

I want it to get input from the user about their favoured Holiday

If the user types in "Christmas" or "Halloween" or "Easter", the computer should respond with the appropriate holiday.

Problem:

The computer is ignoring my else statements

Here is the code for it:

using namespace std;

int choice;
int Christmas;
int Halloween; 
int Easter; 

void GreetingCard() {
    cout << "seasons greetings\n";
}

void HolidayPick() {
    cout << "What's your favourite holiday?\n";
    cin >> choice; 

    if (choice == Christmas) {
        cout << "Merry Christmas\n";
    }
    else if (choice == Halloween) {
        cout << "Happy Halloween\n"; 
    }
    else if (choice == Easter) {
        cout << "Happy Easter\n"; 
    }
    else {
      cout << "Enjoy your Holidays"; 
    }
}


    


Aucun commentaire:

Enregistrer un commentaire